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 9th July 2023 10:54:07 AM | Syntax: JAVA | Views: 499



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
  • Test.php
    1 year 22 weeks 4 days 9 hours 43 mins and 3 secs ago
  • Javascript sample
    1 year 22 weeks 4 days 9 hours 43 mins and 3 secs ago
  • Java Sample
    1 year 22 weeks 4 days 9 hours 43 mins and 3 secs ago
  • Test Document
    1 year 22 weeks 4 days 9 hours 43 mins and 3 secs ago
  • PHP Sample
    1 year 22 weeks 4 days 9 hours 43 mins and 3 secs ago