Advertisement
MARINA_GREBENAROVA

Number_sequence

Oct 6th, 2021
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Number_sequence
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             int maxNum = int.MinValue;
  11.             int minNum = int.MaxValue;
  12.             for (int i = 0; i < n; i++)
  13.             {
  14.                 int num = int.Parse(Console.ReadLine());
  15.  
  16.                 if (num>maxNum)
  17.                 {
  18.                     maxNum = num;
  19.                 }
  20.                 if (num<minNum)
  21.                 {
  22.                     minNum = num;
  23.                 }
  24.  
  25.             }
  26.             Console.WriteLine("Max number: " + maxNum);
  27.             Console.WriteLine("Min number: " + minNum);
  28.  
  29.         }
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement