Saturday, 13 September 2014

Addition of two numbers

java source code

import java.util.*;
class Addition
{
  public static void main(String args[])
  {
     Scanner scr=new Scanner(System.in);
     System.out.print("Enter 1st number:");
     int n1=scr.nextInt();
     System.out.print("Enter 2nd number:");
     int n2=scr.nextInt();
     int sum=n1+n2;
     System.out.println("Addition of "+n1+" and "+n2+" is "+sum);
   }
}

No comments:

Post a Comment