You are viewing a single comment's thread. Return to all comments →
int main() {
int n; scanf("%d", &n); int size=2*n-1; int start=0; int end=size-1; int a[size][size]; while(n!=0) { for(int i=start;i<=end;i++){ for(int j=start;j<=end;j++){ if(i==start||i==end||j==start||j==end) a[i][j]=n; } } start++; end--; n--; } for(int i=0;i<size;i++){ for(int j=0;j<size;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 →
include
include
include
include
int main() {
}