Advertisement
SvetlanPetrova

Floating Equality SoftUni

Jun 12th, 2021
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FloatingEquility {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double eps = 0.000001;
  8.         double n1 = Double.parseDouble(scanner.nextLine());
  9.         double n2 = Double.parseDouble(scanner.nextLine());
  10.  
  11.         boolean isEqual = Math.abs(n1 - n2) < eps;
  12.  
  13.         if (isEqual) {
  14.             System.out.println("True");
  15.         }
  16.         else {
  17.             System.out.println("False");
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement