Pyramid Problem No. 15

 Q.15 Write a program to generate a following numbers structure:

          12345
          1234
          123
          12
          1

Solving in C:

            #include <stdio.h>
            int main(){
                int row,col;
                for(row=1;row<=5;row++){
                    for(col=1;col<=5-row+1;col++) printf("%d",col);
                    printf("\n");
                }
                return 0;
            }

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85