- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAddNumbers.java
More file actions
Latest commit
25 lines (18 loc) · 479 Bytes
/
Copy pathAddNumbers.java
File metadata and controls
25 lines (18 loc) · 479 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
importjava.util.Scanner;
/**
* 8. How to add two number Program.
*/
publicclassAddNumbers {
publicstaticvoidmain(String[] args) {
Scannerscan = newScanner(System.in);
try {
System.out.println("Enter the Two numbers for Sum : ");
floatx = scan.nextFloat();
floaty= scan.nextFloat();
floatz= x + y;
System.out.println("The Sum of Two Numbers are "+ z);
} catch (Exceptione) {
System.out.println("Invalid Input !!!");
}
}
}