In this C program, we will learn how to write a program to print the full pyramid pattern using stars and 'A' character.
Here is the code of the program to print the full pyramid pattern using stars and 'A' character.
/*
C Program To Print Full Pyramid Pattern using stars and 'A' Character
*
*A*
*A*A*
*A*A*A*
*/
#include<stdio.h>
int main()
{
int n, c, k, space, count = 1;
printf("Enter number of rows: ");
scanf("%d", &n);
space = n;
for (c = 1; c <= n; c++)
{
for (k = 1; k < space; k++)
printf(" ");
for (k = 1; k <= c; k++)
{
printf("*");
if (c > 1 && count < c)
{
printf("A");
count++;
}
}
printf("\n");
space--;
count = 1;
}
return 0;
}
Enter number of rows: 5
*
*A*
*A*A*
*A*A*A*
*A*A*A*A*
--------------------------------
Process exited after 1.342 seconds with return value 0
Press any key to continue . . .
Comments