Advertisement
BSO90

Find Maximum Value

May 6th, 2021
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Find_Maximum_Value
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             byte n = byte.Parse(Console.ReadLine());
  10.             short maxValue = short.MinValue;
  11.             for (int i = 1; i <= n; i++)
  12.             {
  13.                 short currNum = short.Parse(Console.ReadLine());
  14.                 if (currNum >= maxValue)
  15.                 {
  16.                     maxValue = currNum;
  17.                 }
  18.             }
  19.             Console.WriteLine(maxValue);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement