Write a C program to implement Spiral Model in Graphics

Implement Spiral Model in Graphics


Write a C program to implement Spiral Model in Graphics. Here’s simple program to implement Spiral Model in Graphics in C Programming Language.


Below is the source code for C program to implement Spiral Model in Graphics which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/*  C program to implement Spiral Model in Graphics  */

#include<graphics.h>
#include<stdio.h>
#include<conio.h>
 
void main()
{
	int r=5,n,i,x,y;
	int graphdriver = DETECT, graphmode;
	initgraph(&graphdriver, &graphmode, "..\\bgi");
 
	setcolor(YELLOW);
	printf("ENTER THE NUMBER OF RINGS IN THE SPIRAL MODEL\n");
	scanf("%d",&n);
	printf("Enter the origin point of the spiral");
	scanf("%d%d",&x,&y);
	clrscr();
	for(i=0;i<n;i++)
	{
		 arc(x,y,0,180,r=r+2);
		 arc(x+2,y,180,360,r=r+2);
	}
	getch();
	closegraph();
}

Above is the source code for C program to implement Spiral Models in Graphics which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

Leave a Reply