NedyalkoKikov

Comparingfloats

Nov 5th, 2015
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. using System;
  2.  
  3. class ComparingFloats
  4. {
  5. static void Main()
  6. {
  7. Console.WriteLine("input two floating point numbers:");
  8. double firstOne = double.Parse(Console.ReadLine());
  9. double secondOne = double.Parse(Console.ReadLine());
  10. bool equalsNumbers = Math.Abs(firstOne - secondOne) < 0.000001;
  11. Console.WriteLine(equalsNumbers);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment