Venciity

[SoftUni Java] Introduction - 06.SumTwoNumbers

May 6th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class SumTwoNumbers {
  5.  
  6.     public static void main(String[] args) {
  7.         System.out.print("Enter first number : ");
  8.         Scanner input1 = new Scanner(System.in);
  9.             int number1 = input1.nextInt();
  10.        
  11.             System.out.print("Enter first number : ");
  12.         Scanner input2 = new Scanner(System.in);
  13.             int number2 = input2.nextInt();
  14.        
  15.             int sum = number1 + number2;
  16.        
  17.             System.out.println();
  18.             System.out.print("Sum = " + sum);
  19.  
  20.             // second variant
  21.        
  22.             //Scanner scanner = new Scanner(System.in);
  23.             //int first = scanner.nextInt();
  24.             //int second = scanner.nextInt();
  25.             //System.out.println(first+second);
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment