Advertisement
IvetValcheva

06. Max Number

Mar 9th, 2024
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1. int maxNum = int.MinValue;
  2.  
  3. string input = Console.ReadLine();
  4.  
  5. while (input != "Stop")
  6. {
  7.     int num = int.Parse(input);
  8.  
  9.     if (num > maxNum)
  10.     {
  11.         maxNum = num;
  12.     }
  13.  
  14.     input = Console.ReadLine();
  15. }
  16.  
  17. Console.WriteLine(maxNum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement