EmbLogic's Blog

Print Star Pattern using for loop.

#include<stdio.h>
int main ()
{
printf(“Program to print a pattern of stars.\n”);
int i1,i2,i3,val;
printf(“Enter a number:\n”);
scanf(“%d”,&val);
for(i1=0;i1<val*2;i1=i1+2)
{
for(i3=val*2;i3>i1;i3=i3-2)
{
printf(” “);
}
for(i2=0;i2<=i1;i2++)
{
printf(“*”);

}
printf(“\n”);
}
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>