Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. const int x = 4;
  6.  
  7. int main()
  8. {
  9. int niz[x][x];
  10. for (int i = 0; i < x; i++)
  11. {
  12. for (int j = 0; j < x; j++)
  13. {
  14. cin >> niz[i][j];
  15. }
  16. }
  17.  
  18.  
  19. system("pause");
  20. return 0;
  21. }
  22. int suma(int niz[][x])
  23. {
  24. int suma = 0;
  25. for (int i = 0; i < x; i++)
  26. {
  27. for (int j = 0; j < x; j++)
  28. {
  29. if (i == j)
  30. {
  31. if (niz[i][j] % 3 == 0)
  32. suma += niz[i][j];
  33. }
  34. }
  35. }
  36.  
  37. return suma;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement