Pyramid Problem No. 42
Q.42 Write a C program to print the following character triangle:
EDCBA DCBA CBA BA A
Solving in C:#include <stdio.h> int main(){ int row,col,ch; ///charecter=ch for(row=5; row>=1; row--){ for(col=1,ch=64+row; col<=row; col++,ch--) printf("%c",ch); printf("\n"); } return 0; }
Comments
Post a Comment