Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Bresenhem Circle drawing algorithm

Program
#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void puracir(x,y,x1,y1)

putpixel(x1+x,y1+y,RED);

putpixel(x1+x,-y1+y,YELLOW);

delay(10);

putpixel(-x1+x,-y1+y,GREEN);

putpixel(-x1+x,y1+y,11);

delay(10);

putpixel(y1+x,x1+y,12);

putpixel(y1+x,-x1+y,12);

delay(10);
putpixel(-y1+x,-x1+y,12);

putpixel(-y1+x,x1+y,12);

void cir(int x,int y,int r)

int x1=0;

int y1=r;

int d=3-2*r;

puracir(x,y,x1,y1);

while(x1<=y1)

if(d<0)

d=d+4*x1+6;

else
{

d=d+4*(x1-y1)+10;

y1--;

x1++;

outtextxy(x-50,y-20,"MAYANK RAJ");

outtextxy(x-50,y,"18SCSE1010336");

puracir(x,y,x1,y1);

void main()

int x,y,r;

int gd = DETECT, gm;

initgraph (&gd, &gm, "C:\TURBOC3\BGI");

printf("Enter cordinates of center (xc,yc): \n");

scanf("%d",&x);

scanf("%d",&y);

printf("Enter the values of there radius: ");

scanf("%d",&r);

cir(x,y,r);
getch();

Output

You might also like