Pages

Friday, 12 June 2015

Star Pattern 6

Star Pattern - 6 - 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<=n-i;j++)
printf(" ");
for(j=1;j<=2*i-1;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}

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