C Program to print Reverse star pyramid Pattern for n number of lines.[Pattern 25]| Using C language| C Program series 46|
Code :
For n number of LINES:
/*
C Program to print Reverse star pyramid for n number of lines.[Pattern 25]
For Example:n=5
* * * * *
* * * *
* * *
* *
*
*/
#include<stdio.h>
main()
{
printf("C Program to print Reverse star pyramid for n number of lines.[Pattern 25]\n\n");
int i,j,n;
printf("Enter number:");
scanf("%d",&n);
printf("==> Reverse star pyramid.\n");
for(i=1;i<=n;i++)
{
printf("\n%d\t",i);//here, '\t' used to shift pattern 1 tab space right side
for(j=1;j<i;j++)
{
printf(" ");
}
for(j=n-i+1;j>0;j--)
{
printf("* ");
}
}
printf("\n");
}
The output of Code:
Comments
Post a Comment