Guest User

Untitled

a guest
Oct 8th, 2018
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P4_FloatingEquality {
  4.  
  5. public static void main(String[] args) {
  6. Scanner scan = new Scanner(System.in);
  7.  
  8.  
  9. float a = Float.parseFloat(scan.nextLine());
  10. float b = Float.parseFloat(scan.nextLine());
  11.  
  12. final float precisionLevel = 0.000001f;
  13.  
  14.  
  15. if (Math.abs(a-b) >= precisionLevel){
  16. System.out.println("False");
  17.  
  18. } else{
  19. System.out.println("True");
  20. }
  21.  
  22.  
  23. }
  24. }
Add Comment
Please, Sign In to add comment