You are viewing a single comment's thread. Return to all comments →
int main() {
int n; scanf("%d", &n); int a[10000],m=((2*n)-1); int p=0,q=m,r=n; // Complete the code to print the pattern. for(int o=0;o<r;o++){ for(int i=p;i<q;i++){ a[i]=n; } for(int j=0;j<m;j++){ printf("%d ",a[j]); } p++; q--; n--; printf("\n"); } n=n+2; for(int o=0;o<r-1;o++){ p--; q++; for(int i=p;i<q;i++){ a[i]=n; } for(int j=0;j<m;j++){ printf("%d ",a[j]); } n++; 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 →
int main() {
}