Advertisement
martinvalchev

Comparing_floats

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