Guest User

Untitled

a guest
Feb 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 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 Task_3._4._2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] numbers = { 1, 5, 6, 8, 15, 43 };
  14.  
  15. Console.WriteLine(SumNumbers(numbers));
  16.  
  17.  
  18. Console.ReadLine();
  19. }
  20. public static int SumNumbers(int[] numbers)
  21. {
  22. int sum = 0;
  23.  
  24. for(int i = 0; i < numbers.Length; i++)
  25. {
  26. sum += numbers[i];
  27. }
  28. return sum;
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment