Wednesday, 26 June 2013

Program To Add Two Numbers In Java.

import java.util.Scanner; 

class AddNumbers
{
   public static void main(String args[])
   {
      int no1, no2, result;
      System.out.println("Enter two integers to calculate their sum ");
      Scanner in = new Scanner(System.in);
      no1 = in.nextInt();
      no2 = in.nextInt();
      result = no1 + no2;
      System.out.println("Sum of entered integers = "+result);
   }
}