Write a program to display half pyramid using stars pattern. * * * * * * * * * * * * * * *
#include <stdio.h>
int main()
{
int i, j, n;
printf("Enter number (n): ");
scanf("%d", &n);
printf("\nHalf pyramid:\n\n");
for (i = 0; i < n; i++)
{
for (j = 0; j < i + 1; j++)
printf("* ");
printf("\n");
}
getchar();
}
Comments
Leave a comment