Program for Addition of two input number using 'Java'.

import java.util.Scanner; // Import the Scanner class


class addition {

  public static void main(String[] args) {

    int x, y, sum;

    Scanner sc = new Scanner(System.in); // Create a Scanner object

    System.out.println("Enter first number:");

    x = sc.nextInt(); // Read user input


    System.out.println("Enter second number:");

    y = sc.nextInt(); // Read user input


    sum = x + y;  // Calculate the sum of x + y

    System.out.println("Addition of entered number is: " + sum); // Print the sum

  }

} 

Popular posts from this blog

In this problem, you will practice your knowledge on interfaces - Hacker Rank Solution.

Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.

Query the Name of any student in STUDENTS who scored higher than 75 Marks - Hacker Rank Solution.