Advertisement
Dianov

While Loop - Lab (06. Max Number)

Dec 29th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MaxNumber
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string command = Console.ReadLine();
  14.             int maxNumber = int.MinValue;
  15.  
  16.             while (command != "Stop")
  17.             {
  18.                 if (int.Parse(command) > maxNumber)
  19.                 {
  20.                     maxNumber = int.Parse(command);
  21.                 }
  22.                 command = Console.ReadLine();
  23.             }
  24.             Console.WriteLine(maxNumber);
  25.         }  
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement