You are viewing a single comment's thread. Return to all comments →
this is my code, i take this idea from a guy in comment :))
int main() {
int n; scanf("%d", &n); // Complete the code to print the pattern. int arr[n*2-1][n*2-1]; for (int i=0; i < n; i++) { for (int j = i; j< 2*n - 1 - i ; j++ ) { arr[i][j] = n - i; arr[2*n-2-i][j] = n - i; arr[j][i] = n - i; arr[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 ",arr[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 →
this is my code, i take this idea from a guy in comment :))
int main() {
}