Tuesday, 28 August 2012

For printing the following pattern

** **
* *
** **
*** ***
**** ****
***** *****
***********
*/
#include<stdio.h>
#define space 15
void main()
{
int i,j,f=6,b,align;
clrscr();
b=f;
for(i=1;i<=13;i++) //Fir6
{
for(align=space;align>0;align--)printf(" "); //space
if(i<=6)
{
for(j=1;j<=11;j++)(j<=f||j>=b)?printf("* "):printf(" ");
i!=6?printf("\n"):NULL;
f--;
b++;
}
else
{
for(j=1;j<=11;j++)j<=f||j>=b?printf("* "):printf(" ");
printf("\n");
f++;
b--;
}
}
getch();
}


If any error or output is different find it out 

No comments:

Post a Comment