Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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 ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] tomb = new int[10];
  14. Random r = new Random();
  15. for (int i = 0; i < 10; i++)
  16. {
  17. tomb[i] = r.Next(0, 100);
  18. Console.WriteLine(tomb[i]);
  19. }
  20.  
  21. int max = tomb[0];
  22. int min = tomb[0];
  23. for (int i = 0; i < 10; i++)
  24. {
  25. if (tomb[i]>max)
  26. {
  27. max = tomb[i];
  28. }
  29. if (tomb[i] < min)
  30. {
  31. min = tomb[i];
  32. }
  33. }
  34. Console.WriteLine($"Max:{max}");
  35. Console.WriteLine($"Min:{min}");
  36. Console.ReadLine();
  37.  
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement