Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class ComparingFloats
- {
- static void Main()
- {
- Console.WriteLine("Enter the first number :");
- decimal FirstNum = decimal.Parse(Console.ReadLine());
- Console.WriteLine("Enter the second number :");
- decimal SecondNum = decimal.Parse(Console.ReadLine());
- if(Math.Abs(FirstNum - SecondNum) < 0.000001m)
- Console.WriteLine("The two numbers are equal with precision 0.000001");
- else
- Console.WriteLine("The difference between the two numbers is more than (or equal to) 0.000001");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement