Pyramid Problem No. 90

 Q.90 Print the nested hash-star pyramid as:

#####*#####
####*#*####
###*###*###
##*#####*##
#*#######*#
*#########*

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 74

Pyramid Problem No. 85