Wednesday, May 6, 2009

PROGRAM TO PRINT STARS IN THE FORM OF RHOMBUS

#include

main()
{
int i,j,k,n,a,b,c,x;
printf("enter the # of rows of graphical output");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\t");
for (k=1;k<=(n-i);k++)
{ printf(" ");
}
for(j=0;j>0;i--)
{
printf("\t");
for (k=(n-i);k>0;k--)
{
printf(" ");
}
for(j=i;j>0;j--)
{
printf("*");
printf(" ");
}
for(k=(n-i-1);k>0;k--)
{
printf(" ");
}
printf("\n");
}

No comments:

Post a Comment

Post a Comment