You are viewing a single comment's thread. Return to all comments →
I hope this is useful!
int main() {
int n; scanf("%d", &n); int a[2*n-1][2*n-1]; for (int i = 0; i<n; i++){ for(int j = 0+i; j<2*n-1-i; j++){ a[0+i][j] = n-i; a[j][0+i] = n-i; a[2*n-2-i][j] = n-i; a[j][2*n-2-i] = n-i; } } for(int i=0; i<2*n-1; i++){ for(int j = 0; j<2*n-1; j++){ printf("%d ", a[i][j]); } printf("\n"); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Printing Pattern Using Loops
You are viewing a single comment's thread. Return to all comments →
I hope this is useful!
int main() {
}