2012-08-21T08:08:41-04:00
display the following
1
121
12321
1234321
12321
121
1
1
2012-08-21T10:11:23-0400
#include<stdio.h> #include<conio.h> int main() { int num,r,c,sp; printf("Enter number of rows : "); scanf("%d",&num); for(r=1; r<=num; r++) { for(sp=num-r; sp>=1; sp--) printf(" "); for(c=1; c<=r; c++) printf("%d",c); for(c=r-1; c>=1; c--) printf("%d",c); printf(" "); } for(r=1; r<=num; r++) { for(sp=r; sp>=1; sp--) printf(" "); for(c=1; c<=(num-r); c++) printf("%d",c); for(c=num-r-1; c>=1; c--) printf("%d",c); printf(" "); } getch(); return 0; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments