Pyramid Problem No. 59
Q.59 Write a C program to print the number character pyramid as:
1 AB 123 ABCD 12345
Solving in C:#include <stdio.h>
int main(){
int row,col,ch_count;
for(row=1; row<=5; row++){
for(col=1,ch_count=65; col<=row; col++){
if(row%2==0) printf("%c",ch_count++);
else printf("%d",col);
}
printf("\n");
}
return 0;
}
Comments
Post a Comment