Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class ComparingFloats
- {
- static void Main()
- {
- System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
- Console.Write("Write a number a: ");
- double a = double.Parse(Console.ReadLine());
- Console.Write("Write a number b: ");
- double b = double.Parse(Console.ReadLine());
- double eps = 0.000001;
- if (Math.Abs(a - b) > eps)
- {
- Console.WriteLine("false");
- }
- else if (Math.Abs(a-b) < eps)
- {
- Console.WriteLine("true");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment