#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>int main()
{
int p,x,y,r;
void cal_point(int xc,int yc,int x,int y);
clrscr();
printf("Enter the value of radius ");
scanf("%d",&r);
x=0;
y=r;
p=1-r;
while(x<y)
{
if(p<0)
{
x=x+1;
y=y;
p = p+2*x+1;
}
else
{
x=x+1;
y=y-1;
p = p+2*x+1-2*y;
}
printf("(%d,%d)\n",x,y);
cal_point(0,0,x,y);
getch();
}
getch();
return 0;
}void cal_point(int xc,int yc,int x,int y)
{
printf("(%d,%d)\n",(xc+x),(yc+y));
printf("(%d,%d)\n",(xc-x),(yc-y));
printf("(%d,%d)\n",(xc+x),(yc-y));
printf("(%d,%d)\n",(xc-x),(yc+y));
printf("(%d,%d)\n",(xc+y),(yc+x));
printf("(%d,%d)\n",(xc-y),(yc-x));
printf("(%d,%d)\n",(xc+y),(yc-x));
printf("(%d,%d)\n",(xc-y),(yc+x));
}
#include<graphics.h>
int main() { int p,x,y,r=10; void cal_point(int xc,int yc,int x,int y); int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "c:\\tc\\bgi"); x=0; y=r; p=1-r;
#include<stdio.h>
#include<conio.h>
#include<math.h>while(x<y)
{
if(p<0)
{
x=x+1;
y=y;
p = p+2*x+1;
}
else
{
x=x+1;
y=y-1;
p = p+2*x+1-2*y;
}
cal_point(40,40,x,y);
}
getch();
closegraph();
return 0;
}
void cal_point(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,3);
putpixel(xc-x,yc-y,3);
putpixel(xc+x,yc-y,3);
putpixel(xc-x,yc+y,3);
putpixel(xc+y,yc+x,3);
putpixel(xc-y,yc-x,3);
putpixel(xc+y,yc-x,3);
putpixel(xc-y,yc+x,3);
}