The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Java Sample
By Guest on 8th February 2020 10:54:07 AM | Syntax: JAVA | Views: 83



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. import java.util.Scanner;
  2. public class AddTwoNumbers2 {
  3.  
  4.     public static void main(String[] args) {
  5.        
  6.         int num1, num2, sum;
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Enter First Number: ");
  9.         num1 = sc.nextInt();
  10.        
  11.         System.out.println("Enter Second Number: ");
  12.         num2 = sc.nextInt();
  13.        
  14.         sc.close();
  15.         sum = num1 + num2;
  16.         System.out.println("Sum of these numbers: "+sum);
  17.     }
  18. }



  • Recent Pastes
  • Lopaaz
    23 hours 43 mins 5 secs ago
  • Fdaa
    1 day 10 hours 46 mins 46 secs ago
  • Hahahahbw
    1 day 18 hours 38 mins 44 secs ago
  • Jajajajaj
    1 day 18 hours 39 mins 45 secs ago
  • Asd
    3 days 15 hours 12 mins 13 secs ago