Pyramid Problem No. 22

 Q.22 Write a C program to print the following character triangle:

          A
          B B
          C C C
          D D D D

Solving in C:

        #include <stdio.h>
        int main(){
            int row,col,count;
            for(row=1,count=65;row<=4;row++,count++){
                for(col=1;col<=row;col++) printf("%c ",count);
                printf("\n");
            }
            return 0;
        }

Comments

Popular posts from this blog

Pyramid Problem No. 90

Pyramid Problem No. 74

Pyramid Problem No. 85