You are viewing a single comment's thread. Return to all comments →
scanf("%d", &n); // Complete the code to print the pattern. for(i=0;i<n;i++){ temp=n; for(j=0;j<n;j++){ printf("%d ",temp); if(j<i) temp--; } for(j=(n-2);j>0;j--){ if(j<i) temp++; printf("%d ",temp); } printf("%d\n",n); } for(i=0;i<(n-1);i++){ temp=n; for(j=n;j>0;j--){ printf("%d ",temp); if((i+2)<j) temp--; } for(j=0;j<(n-2);j++){ if(i<j) temp++; printf("%d ",temp); } printf("%d\n",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 →
`