Pyramid Problem No. 64

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

1
232
34543
4567654

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85