Advertisement
Dimitar46

3. Floating Equality

Jun 3rd, 2022
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _00.Demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double number1 = double.Parse(Console.ReadLine());
  10.             double number2 = double.Parse(Console.ReadLine());
  11.             double eps = 0.000001;
  12.             double difference = Math.Abs(number1 - number2);
  13.            
  14.             if (difference < eps)
  15.             {
  16.                 Console.WriteLine("True");
  17.             }
  18.             else
  19.             {
  20.                 Console.WriteLine("False");
  21.             }
  22.         }
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement