#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
void main(){
int gd=DETECT, gm;
int xc,yc,r,p,x,y;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
x=0;
printf("Enter radius : \n");
scanf("%d",&r);
y=r;
printf("Enter x center and y center : \n");
scanf("%d%d",&xc,&yc);
drawcircle(xc,yc,x,y);
p=1-r;
while(x<y){
if(p<0){
x++;
}
else{
x++;
y--;
}
if(p<0)
p=p+2*x+1;
else
p=p+2*(x-y)+1;
drawcircle(xc,yc,x,y);
}
getch();
}
int drawcircle(int xc, int yc, int x, int y){
putpixel(xc+x,yc+y,1);
putpixel(xc+y,yc+x,1);
putpixel(xc-y,yc+x,1);
putpixel(xc-x,yc+y,1);
putpixel(xc-x,yc-y,1);
putpixel(xc-y,yc-x,1);
putpixel(xc+y,yc-x,1);
putpixel(xc+x,yc-y,1);
return 0;
}