Print Letters Pyramid using For Loop
Write a C Program to Print Letters Pyramid using For Loop. Here’s simple C Program to Print Letters Pyramid using For Loop in C Programming Language.
Here is source code of the C Program to Print Letters Pyramid using For Loop. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* C Program to Print Letters Pyramid using For Loop */ #include<stdio.h> int main() { int i, j; char symbol = 'A'; int num; int count = 1; printf("Enter 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"); } return (0); }
Output : :
/* C Program to Print Letters Pyramid using For Loop */ 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
Above is the source code for C Program to Print Letters Pyramid using For Loop which is successfully compiled and run on Windows System.The Output of the program is shown above .
If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.
Thanks for reading the post….