Pyramid Problem No. 33
Q.33 Write a C program to print the following number structure:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6Solving in C:#include <stdio.h> int main(){ int row,col; for(row=1;row<=6;row++){ for(col=5;col>=row;col--) printf(" "); for(col=1;col<=row;col++)printf("%d ",col); printf("\n"); } return 0; }
Comments
Post a Comment