Pyramid Problem No. 86
Q.86 Design the following continues number pyramid:
1 121 12321 1234321 123454321
Solving in C:#include <stdio.h> int main(){ int n=5,row,col,count=1; for(row=1; row<=n; row++){ for(col=1,count=1;col<=row; col++) printf("%d",count++); for(col=1,count=row-1; col<row; col++) printf("%d",count--); printf("\n"); } return 0; }
Comments
Post a Comment