Pyramid Problem No. 58

 Q.58 Write a C program to print the following number pyramid/triangle:

54321
5432
543
54
5

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85