Pyramid Problem No. 74

 Q.74 Write a C program to print the following number pyramid:

1333
2222
3331
Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 85