Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 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 MoyaConsoleApp
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int[,] a =
  15. {
  16. {1 ,4 ,5 ,1 ,3},
  17. {1 ,1 ,5 ,3 ,1},
  18. {3 ,5 ,1 ,5 ,3},
  19. {5 ,1 ,3 ,5 ,1},
  20. {7 ,1 ,1 ,5 ,7}
  21. };
  22. int s = 0;
  23. int g = 0;
  24. for (int i = 0; i < a.GetLength(0); i++)
  25. {
  26. for (int j = 0; j < a.GetLength(0); j++)
  27. {
  28.  
  29. if (a[i, j] % 2 == 0)
  30. g = j;
  31.  
  32.  
  33.  
  34.  
  35. }
  36. s = s + a[i, g];
  37. }
  38.  
  39. Console.WriteLine(s);
  40. Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement