Star Print in C |
In this program, you will learn how to print star in a c program.
C Program to Print Star:
#include<stdio.h>
main()
{
int n,i,j,k;
printf("Enter a number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
{
printf("");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}
for(i=n-1;i>=1;i--)
{
for(j=1;j<=n-i;j++)
{
printf("");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}
}
0 Comments