Monday, 21 July 2014

Java Program To Add 2 numbers

  1. import java.util.Scanner;
  2. class AddNumbers
  3. {
  4. public static void main(String args[])
  5. {
  6. int x, y, z;
  7. System.out.println("Welcome!! Program by Kidshelp & Computerwizardi");
  8. System.out.println("Enter two integers to calculate their sum ");
  9. Scanner in = new Scanner(System.in);
  10. x = in.nextInt();
  11. y = in.nextInt();
  12. z = x + y;
  13. System.out.println("Sum of entered integers = "+z);
  14. }
  15. }

No comments:

Post a Comment

Breaking