Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication5
  7. {
  8. class Program
  9. {
  10.  
  11. public static int licz (List<int> lista)
  12. {
  13. int a = 0;
  14. for (int i = 0; i < lista.Count; i++)
  15. {
  16. a = a + lista.ElementAt(i);
  17.  
  18. }
  19.  
  20. return a;
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. static void Main(string[] args)
  33. {
  34. List<int> liczby=new List<int>();
  35. liczby.Add(4);
  36. liczby.Add(6);
  37. liczby.Add(9);
  38.  
  39.  
  40.  
  41.  
  42.  
  43. Console.WriteLine(licz(liczby));
  44. Console.ReadKey();
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement