tsvetelinapasheva

TsvetelinaPasheva/ForLoopLab/08.NumberSequence

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