C Program To Print Square Of Stars

C Program To Print Square Of Stars
Output will be like:
***
*  *
***

code:

//C Program to Print Square of Stars
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
for(a=1;a<=3;a++)
{
for (b=1;b<=a;b++)
{
if(a==2&&b==2)
{
printf(" ");
}
else
{
printf("*");
}
}
for(b=(3-a);b>=1;b--)
{
printf("*");
}
printf("\n");
}
getch();
}
Give comments if you have any doubts... :)
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...
 
Posts RSSComments RSSBack to top
© 2013 Updated Tech News Results and Reviews