Java program for sum of any two numbers
//take values form user
import java.util.Scanner;
public class Sum
{
public static void main(String [ ] args)
{
Scanner s=new Scanner(System.in);
int a, b, c;
System.out.println("Enter any two number ");
a=s.nextInt();
b=s.nextInt();
c=a+b;
System.out.println("Sum is "+c);
}
}
Output
Enter any two number
10
20
Sum is30
Comments