Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 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. List<int> l1 = new List<int>();
  13. l1.Add(1);
  14. l1.Add(13);
  15. l1.Add(-8);
  16. l1.Add(-45);
  17. Console.WriteLine(Max(l1));
  18. Console.ReadKey();
  19. }
  20.  
  21. public static int Max(List<int> list)
  22. {
  23. int suma = 0;
  24.  
  25. for (int i = 1; i < list.Count; i++){
  26. suma += list[i];
  27. }
  28. return suma;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement