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