Output:
Click Here For Java Online Compiler
Solution:
*** Add Two Numbers *** Enter first number: 3 Enter second number: 8 Sum of 3 and 8 is: 11
Click Here For Java Online Compiler
Solution:
import java.util.Scanner; class AddTwoNumbersTakingInput { public static void main(String[] args) { int num1 = 0; int num2 = 0; int sum = 0; Scanner sc = new Scanner(System.in); System.out.println("*** Add Two Numbers ***" + "\n"); System.out.print("Enter first number: "); num1 = sc.nextInt(); System.out.print("Enter second number: "); num2 = sc.nextInt(); sum = num1 + num2; System.out.println("Sum of " + num1 + " and " + num2 + " is: " + sum); } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon