Program to Print Largest Number Pyramid
Program :
#include<stdio.h> #include<conio.h> void main() { int i,j; char symbol='A'; int check = 0; int num; int count=1; clrscr(); printf("\nEnter the number of Letters in Pyramid "); printf("(less than 26): "); scanf("%d",&num); for(i=1;i<=num;i++) { for(j=0;j<=(count/2);j++) printf("%c ",symbol++); symbol = symbol - 2; for(j=0;j<(count/2);j++) printf("%c ",symbol--); count = count + 2; symbol = 'A'; printf("\n"); } getch(); }
Output :
Enter the number of Letters in Pyramid (less than 26): 13 A A B A A B C B A A B C D C B A A B C D E D C B A A B C D E F E D C B A A B C D E F G F E D C B A A B C D E F G H G F E D C B A A B C D E F G H I H G F E D C B A A B C D E F G H I J I H G F E D C B A A B C D E F G H I J K J I H G F E D C B A A B C D E F G H I J K L K J I H G F E D C B A A B C D E F G H I J K L M L K J I H G F E D C B A
No comments:
Post a Comment