0

i have to make one prg in c
that accept only odd number (no) which is (4>no>30) & have to
genrate the pertern which is given below

when no=7 then given petern should be genrated


for that i have do some coding but i can't get the exatly petern..

pls help to solve this problem

thanx in advance .....

#include<stdio.h>
#include<conio.h>

void main()
{
	int no,i,j,no1;
	clrscr();

	printf("Enter Number Of Lines: ");
	scanf("%d",&no);

	no1=no/2;

	for(i=1;i<=no1;i++)
	{
		for(j=i;j<no;j++)
			printf(" ");

		for(j=1;j<=i;j++)
		{
			if(j==1 || j==i)
			printf("* ");

			else
			printf("  ");
		}
		printf("\n");
	}
	for(i=1;i<=no*2-1;i++)
		printf("*");

	for(i=1;i<=no;i++)
	{
		if(i%2==0)
		{
			for(j=1;j<=i;j++)
			{
				//printf("*");
			}

		}
		else
		printf("\n");
	}


	for(i=1;i<=no*2-1;i++)
	printf("*");
	printf("\n");

	for(i=no1;i>0;i--)
	{
		for(j=i;j<no;j++)
			printf(" ");

		for(j=1;j<=i;j++)
		{
			if(j==1 || j==i)
			printf("* ");

			else
			printf("  ");
		}
		printf("\n");
	}

getch();
}
Attachments star.JPG 8.17 KB
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by nitu_thakkar
0

Hi,
I had som difficulties understanding what you wanted but I think I got it now.

You want draw a star with an uneven number of points using stdoutput?

Do you use some special algorithm for drawing the star,
or is that your problem?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.