Pyramid Problem No. 31
Q.31. Write a C program to display the following number triangle structure:
54321
4321
321
21
1Solving in C:#include <stdio.h> int main(){ int row,col; for(row=5;row>=1;row--){ for(col=5;col>=1;col--){ if(row>=col) printf("%d",col); else printf(" "); } printf("\n"); } return 0; }
Comments
Post a Comment