PiotrJurek

Zad15

Apr 17th, 2020
61
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.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int x;
  8. cout << "Podaj rozmiar tablicy kwadratowej" << endl;
  9. cin >> x;
  10. int matrix[x][x];
  11. for(int i=0; i<x; i++)
  12. {
  13. for(int j=0; j<x; j++)
  14. {
  15. if(i==j)
  16. {
  17. matrix[i][j]=0;
  18. }
  19. else
  20. {
  21. matrix[i][j]=1;
  22. }
  23. cout << matrix[i][j] << " ";
  24. }
  25. cout << endl;
  26. }
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment