- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram09_FloatingPoint.java
More file actions
Latest commit
21 lines (19 loc) · 740 Bytes
/
Copy pathProgram09_FloatingPoint.java
File metadata and controls
21 lines (19 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Write a Java program that reads two floating-point numbers and tests whether they are the same up to three decimal places.
// Date : 27/12/2023, Author : Yash Wadhvani
importjava.util.Scanner;
publicclassProgram09_FloatingPoint {
publicstaticvoidmain(String[] args) {
floata, b;
try (Scannersc = newScanner(System.in)) {
System.out.println("Enter a Floating Point Number :-");
a = sc.nextFloat();
System.out.println("Enter another Floating Point Number :-");
b = sc.nextFloat();
}
if (a == b) {
System.out.println("Numbers are Equal.");
} else {
System.out.println("Numbers are Not Equal.");
}
}
}