Advertisement
mihael03

Number_sequence

Oct 12th, 2020
2,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 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 Number_sequence
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int num = int.Parse(Console.ReadLine());
  14.             double minResult = int.MinValue;
  15.             double maxResult = int.MaxValue;
  16.             for (int i = 1; i <= num; i++)
  17.             {
  18.                 int n = int.Parse(Console.ReadLine());
  19.                 if (n < maxResult)
  20.                 {
  21.                     maxResult = n;
  22.                 }
  23.                 else if (n > minResult)
  24.                 {
  25.                     minResult = n;
  26.                 }
  27.             }
  28.             Console.WriteLine("Max number: {0}", minResult);
  29.             Console.WriteLine("Min number: {0}", maxResult);
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement