Pyramid Problem No. 46

 Q. 46 Write a C program for print the following number pyramid:

123456654321
1234554321
12344321
123321
1221
11

Solving in C:

    #include <stdio.h>
        int main(){
            int row,col; 
            for(row=6; row>=1; row--){
                for(col=1; col<=row; col++) printf("%d",col);
                for(col=row; col>=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