Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<graphics.h>
- void main()
- {
- int r,x,y,d,gd,gm;
- detectgraph(&gd,&gm);
- initgraph(&gd,&gm,"C:\TC\BIN");
- printf("enter the radius of circle");
- scanf("%d",&r);
- d=3-(2*r); // initialising decision variable
- x=0;
- y=r;
- do
- {
- putpixel(200+x,200+y,15);
- putpixel(200+y,200+x,15);
- putpixel(200+y,200-x,15);
- putpixel(200+x,200-y,15);
- putpixel(200-x,200-y,15);
- putpixel(200-y,200-x,15);
- putpixel(200-y,200+x,15);
- putpixel(200-x,200+y,15);
- if(d<0)
- {
- d=d+(4*x)+6;
- }
- else
- {
- d=d+4*(x-y)+10;
- y=y-1;
- }
- x=x+1;
- }
- while(x<y);
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement