Pyramid Problem No. 55

 Q. 55 Write a C program to print the following star pattern pyramid:

*
***
******

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85