Java Program To Sum Of 2 Numbers

      No Comments on Java Program To Sum Of 2 Numbers

Here is the code to sum two numbers using java:

import java.util.Scanner;

class scan
{
public static void main(String arg[])
 {
 Scanner s1=new Scanner(System.in);
int sum,x,y;
    System.out.println("Enter first Number");
x=s1.nextInt();
    System.out.println("Enter second Number");
y=s1.nextInt();
sum=x+y;
    System.out.println("Sum of Numbers is:- "+sum);
}
}

The result of java code:

OUTPUT:-

Enter first Number
34
Enter second Number
67
Sum of Numbers is:- 101

Leave a Reply

Your email address will not be published. Required fields are marked *