Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. //Silnik s1 = new Silnik(150, 55.5, "Ford");
  13. //s1.Wyswietl();
  14. //Console.ReadKey();
  15. List<int> l1 = new List<int>();
  16. l1.Add(1);
  17. l1.Add(15);
  18. l1.Add(-3);
  19. l1.Add(44);
  20. Console.WriteLine(Max(l1));
  21. Console.ReadKey();
  22. }
  23.  
  24. public static int Max(List<int> list)
  25. {
  26. int max=list[0];
  27.  
  28. for (int i = 1; i < list.Count; i++)
  29. if (max < list[i])
  30. max = list[i];
  31. return max;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement