Advertisement
remote87

CompareTo.Metod

Aug 22nd, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. double firstValue = double.Parse(Console.ReadLine());
  2. double secondValue = double.Parse(Console.ReadLine());
  3. switch (firstValue.CompareTo(secondValue))
  4. {
  5.     case 1:
  6.         Console.WriteLine("{0} > {1}", firstValue, secondValue);
  7.     break;
  8.     case -1:
  9.         Console.WriteLine("{0} < {1}", firstValue, secondValue);
  10.     break;
  11.     default:
  12.         Console.WriteLine("{0} = {1}", firstValue, secondValue);
  13.     break;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement