Pyramid Problem No. 88

 Q.88 print diagonal star-zero pyramid as:

*000000
0*00000
00*0000
000*000
0000*00
00000*0
000000*

Solving in C:

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

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85