Advertisement
guilpter

Untitled

May 25th, 2019
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 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 n = int.Parse(Console.ReadLine());
  14. int min = int.MaxValue;
  15. int max = int.MinValue;
  16. for (int i = 1; i <= n; i++)
  17. {
  18. int num = int.Parse(Console.ReadLine());
  19.  
  20. if (num <= min)
  21. {
  22. min = num;
  23. }
  24. else if(num >= max)
  25. {
  26. max = num;
  27. }
  28. }
  29. Console.WriteLine("Max number: {0}", max);
  30. Console.WriteLine("Min number: {0}", min);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement