Pages

Friday, 12 June 2015

Star pattern 8

Star Pattern - 8 - program in C

Coding:

#include<stdio.h>
int main()
{
int i,j,n;
printf("Please enter number of lines:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<i;j++)
printf(" ");
for(j=n;j>=i;j--)
{
printf("*");
}
printf("\n");
}
return 0;
}

Output:
Please enter number of lines:5
*****
 ****
  ***
   **
    *