Pyramid Problem No. 82

 Q.82 Print below nested star pyramid as:

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

Solving in C:

#include <stdio.h>
    int main(){
        int row,col;
        for(row=1; row<=3; row++){
            for(col=1;col<=11; col++){
                if(col==11/2+1 || col==row+1 || col==11-row)  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