Guest User

Untitled

a guest
Oct 18th, 2019
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. using namespace std;
  3. int main() {
  4. int a[100][100], n;
  5. scanf_s("%d", &n);
  6. for (int i = 0; i < n; i++)
  7. for (int j = 0; j < n; j++)
  8. scanf_s("%d", &a[i][j]);
  9.  
  10. for (int i = 0; i < n; i++)
  11. for (int j = i; j < n; j++)
  12. {
  13. int buff = a[i][j];
  14. a[i][j] = a[j][i];
  15. a[j][i] = buff;
  16. }
  17.  
  18. for (int i = 0; i < n; i++) {
  19. for (int j = 0; j < n; j++)
  20. {
  21. printf("%d ", a[i][j]);
  22. }
  23. printf("\b\n");
  24. }
  25. return 0;
  26. }
RAW Paste Data