Pyramid Problem No. 91
Q.91 Print half-square number triangle as:
543212345
4321234
32123
212
1Solving in C:#include <stdio.h> int main(){ int row,col; for(row=1; row<=5; row++){ for(col=5; col>=1; col--){ if(5-row+1<col) printf(" "); else printf("%d",col); } for(col=2; col<=5-row+1; col++) printf("%d",col); printf("\n"); } return 0; }
Comments
Post a Comment