Open Rohyoohyun opened 2 months ago
#include <stdio.h> int main(){ int arr[101][101]; int n, x = 1, i, j; scanf("%d", &n); for(i=1; i<=n; i++){ if(i%2 == 1){ for(j=1; j<=n; j++){ arr[j][i] = x; x++; } }else{ for(j=n; j>=1; j--){ arr[j][i] = x; x++; } } } for(i=1; i<=n; i++, puts("")) for(j=1; j<=n; j++) printf("%d ", arr[i][j]); return 0; }