Advertisement
danny-iv

Matrica

Nov 7th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int mat[2][3];
  7. int sum [3];
  8. int i, j;
  9. for (i = 0; i < 2; i++){
  10. for (j = 0; j < 3; j++){
  11. cout << "mat[" << i << "][" << j << "]=";
  12. cin >> mat[i][j];
  13. }
  14. }
  15. for (j = 0; j < 3; j++) {
  16. sum[j] = 0;
  17. for (i = 0; i < 2; i++){
  18. cout << mat[i][j] << " ";
  19. sum[j] = sum[j] + mat[i][j];
  20. }
  21. cout << endl;
  22. }
  23. for (j = 0; j < 3; j++)
  24. cout << "sumata ot koloni " << j << " e " << sum[j] << endl;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement