fork download
  1. #include<bits/stdc++.h>
  2. typedef long long ll;
  3. using namespace std;
  4. int main()
  5. {
  6. int a[3][3];
  7. for(int i=0;i<3;i++){
  8. for(int j=0;j<3;j++){
  9. cin >> a[i][j];
  10. }
  11. }
  12. for(int i=0;i<3;i++){
  13. for(int j=0;j<3;j++){
  14. cout << a[j][i];
  15. if(j<2){
  16. cout << " ";
  17. }
  18. else{
  19. cout << endl;
  20. }
  21. }
  22. }
  23. }
Success #stdin #stdout 0s 4276KB
stdin
1 2 3
4 5 6
7 8 9
stdout
1 4 7
2 5 8
3 6 9