Pyramid Problem No. 54

 Q. 54 Write a C program to print the star triangle frame pyramid like as:

*
**
* *
*  *
*   *
*    *
*     *
*      *
*       *
**********

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85