Sum2.java

Aim:
To find sum of two numbers

Source code:
import java.util.*;
import java.lang.*;
class Sum2
 {
   public static void main(String args[])
     {
       int a,b,sum;
       System.out.println("Enter values for a,b");
       Scanner s1=new Scanner(System.in);
       a=s1.nextInt();
       b=s1.nextInt();
       sum=a+b;
       System.out.println("Sum of two numbers="+sum);
     }
  }

Output:
Enter values for a,b
10
12
Sum of two numbers=22













No comments:

Post a Comment