forked from kriru/firstJava
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddi.java
More file actions
Latest commit
20 lines (16 loc) · 527 Bytes
/
Copy pathAddi.java
File metadata and controls
20 lines (16 loc) · 527 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
classAddi{
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
System.out.print("Enter the first number: ");
intnum1 = scanner.nextInt();
System.out.print("Enter the second number: ");
intnum2 = scanner.nextInt();
intsum = num1 + num2;
System.out.println("The sum of " + num1 + " and " + num2 + " is: " + sum);
scanner.close();
}
}
output:
Enterthefirstnumber:2
Enterthesecomgnumber:3
Thesumof2and3is:5