You are viewing a single comment's thread. Return to all comments →
my code is running for cases 0-4. please explain the problem
int main() {
int n,i,j,k,a=0; scanf("%d", &n); k=n; int arr[100][100]; int cc=0; do { for(i=cc;i<2*n-cc-1;i++) { for(j=cc;j<2*n-cc-1;j++) { if(i==a||j==a||i==n*2-a-2||j==n*2-a-2) arr[i][j]=k; } } cc++; k--; a++; }while(k>0); for(i=0;i<n*2-1;i++) { for(j=0;j<n*2-1;j++) { printf("%d ",arr[i][j]); } printf("\n"); } }
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 →
my code is running for cases 0-4. please explain the problem
include
include
include
include
int main() {