From b913b4a67e48bf6447181507950c89f8c2f54b8b Mon Sep 17 00:00:00 2001 From: Jahnavik110 <159251114+Jahnavik110@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:59:27 +0530 Subject: [PATCH] Create Add.java --- Add.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Add.java diff --git a/Add.java b/Add.java new file mode 100644 index 0000000..a27e885 --- /dev/null +++ b/Add.java @@ -0,0 +1,20 @@ + class Add{ + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter the first number: "); + int num1 = scanner.nextInt(); + + System.out.print("Enter the second number: "); + int num2 = scanner.nextInt(); + + int sum = num1 + num2; + System.out.println("The sum of " + num1 + " and " + num2 + " is: " + sum); + + scanner.close(); + } +} +output: +Enter the first number:2 +Enter the secomg number:3 +The sum of 2 and 3 is:5