Home » Solved Programs » C program to print Pyramid using star (*)
C program to print Pyramid using star (*)
This C program ask user to enter height of Pyramid, the Pyramid is printed using *
#include<stdio.h>
int main ()
{
int i,j, height;
printf("\nEnter the height of Pyramid : ");
scanf("%d",&height);
printf("\n\n");
for (i = 1; i <= height; i++) // for-1(outer) used to control row
{
for (j = 1; j <= i; j++) // for-2(inner) used // to print ‘*’
{
printf("*");
}
printf ("\n");
}
//it will hold the screen
getchar();
return 0;
}