#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int i,j,n; int a[n][n]; scanf("%d",&n); for(i=0;i<n;i++){ for(j=0;j<n;j++){ scanf("%d",&a[i][j]); } } for(i=0;i<n;i++){ for(j=0;j<n;j++){ printf("%d",a[j][i]); if((j+1)%n) { printf (" ") ; } } printf("\n"); } return 0; } |
Double click to view unformatted code.