C program to print star pattern of inverted triangle shape.
For N=5,
* * * * *
* * * *
* * *
* *
*
- #include<stdio.h>
- int main()
- {
- int i,j,n=5;
- for(j=0; j<n; j++)
- {
- for(i=n; i>n-j; i--)
- printf(" ");
- for(i=0; i<n-j; i++)
- printf("* ");
- printf("\n");
- }
- return 0;
- }
Output
* * * * *
* * * *
* * *
* *
*
Comments