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