Yachkov

number sequence 40/100

Jan 31st, 2021 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.Design;
  5. using System.Globalization;
  6. using System.Net.Http.Headers;
  7. using System.Reflection;
  8. using System.Runtime.ConstrainedExecution;
  9. using System.Security.Cryptography;
  10.  
  11.  
  12. namespace SomeExcercises
  13. {
  14.     class Program
  15.     {
  16.         static void Main(string[] args)
  17.         {
  18.             int n1 = 0;
  19.             int n = int.Parse(Console.ReadLine());
  20.             int biggest = int.MinValue;
  21.             int smallest = int.MaxValue;
  22.  
  23.             for (int i = 0; i < n; i++)
  24.             {
  25.                 n1 = int.Parse(Console.ReadLine());
  26.                 if (n1 > biggest )
  27.                 {
  28.                     biggest = n1;
  29.                 }
  30.                 else if (n1 < smallest)
  31.                 {
  32.                     smallest = n1;
  33.                 }
  34.                
  35.             }
  36.  
  37.             Console.WriteLine($"Max number: {biggest}");
  38.             Console.WriteLine($"Min number: {smallest}");
  39.            
  40.         }
  41.     }
  42. }
  43.  
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment