Advertisement
dimipan80

Sum Two Numbers

Aug 17th, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. /* Write a program SumTwoNumbers.java that enters two integers from the console,
  2.  * calculates and prints their sum. */
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class _06_SumOfTwoNumbers {
  7.  
  8.     public static void main(String[] args) {
  9.         // TODO Auto-generated method stub
  10.         Scanner scan = new Scanner(System.in);
  11.         System.out.print("Enter two Integer numbers: ");
  12.         int numA = scan.nextInt();
  13.         int numB = scan.nextInt();
  14.  
  15.         long sumOfIntegers = numA + numB;
  16.  
  17.         System.out.println("The Sum of these 2 numbers is: " + sumOfIntegers);
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement