Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Add.java
Original file line number Diff line number Diff line change
@@ -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