Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
807 B
1
Indexable
Never
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
int gd=DETECT,gm;
void main()
{
	int x,y,r,xc,yc,step,i=1,th=90;
	printf("Enter the center co-ordinate of the circle:");
	scanf("%d%d",&xc,&yc);
	printf("Enter the radius of the circle:");
	scanf("%d",&r);
	printf("Enter the step:");
	scanf("%d",&step);
	x=0,y=r;
	initgraph(&gd,&gm,NULL);
	putpixel(xc+x,yc+y,i);
	putpixel(xc-x,yc+y,i);
	putpixel(xc+x,yc-y,i);
	putpixel(xc-x,yc-y,i);
	while(th>=45)
	{
		delay(100);
		x=r*cos(th*0.01745);
		y=r*sin(th*0.01745);
		th=th-step;

		putpixel(xc+x,yc+y,i/8);
		putpixel(xc-x,yc+y,i/8);
		putpixel(xc+x,yc-y,i/8);
		putpixel(xc-x,yc-y,i/8);
		putpixel(xc+y,yc+x,i/8);
		putpixel(xc-y,yc+x,i/8);
		putpixel(xc+y,yc-x,i/8);
		putpixel(xc-y,yc-x,i/8);
		i++;	
	}
	getch();
	closegraph();
}