desislava_topuzakova

минимално число

Jun 6th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Demo
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. List<int> list = new List<int> { 3, 4, 5, 6 };
  11. Console.WriteLine(Min(list));
  12.  
  13.  
  14.  
  15.  
  16.  
  17. }
  18.  
  19. public static int Min( List<int> list)
  20. {
  21. int min = int.MaxValue;
  22. foreach (int number in list)
  23. {
  24. if(number < min)
  25. {
  26. min = number;
  27. }
  28. }
  29.  
  30. return min;
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37. }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment