Warning: mysqli_connect(): (HY000/2002): Connection refused in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 38

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 40

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 41

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 45

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 48

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 49
C Program for Drawing a Circle using Bresenham Circle Algorithm - Get Program Code
Home / C / C Program for Drawing a Circle using Bresenham Circle Algorithm

C Program for Drawing a Circle using Bresenham Circle Algorithm

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int gd=DETECT,gm;
int d,r,x,y,xc,yc;
clrscr();
initgraph(&gd,&gm,"c:\\tc\\");
printf("Enter Radius\n");
scanf("%d",&r);
printf("Enter Center of circle\n");
scanf("%d",&xc);
scanf("%d",&yc);
d=3-2*r;
x=0;
y=r;
while(x<=y)
{
putpixel(xc+x,yc+y,5);
putpixel(xc-y,yc-x,5);
putpixel(xc+y,yc-x,5);
putpixel(xc-y,yc+x,5);
putpixel(xc+y,yc+x,5);
putpixel(xc-x,yc-y,5);
putpixel(xc+x,yc-y,5);
putpixel(xc-x,yc+y,5);
if(d<=0)
{
d=d+4*x+6;
}
else
{
d=d+4*x-4*y+10;
y=y-1;
}
x=x+1;
}
getch();
}

Output:

C program for Bresenhams circle algorithm
Tags: C program for drawing a circle using Bresenhams circle algorithm, C program for Bresenhams circle algorithm

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

One comment

  1. thanks the code is simple an easily undersatndable

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.