Circle function is one of the library function of Graphics.h header file. It draws a circle on to the output screen. It takes three arguments, the first two are for centre coordinate and the last one represents the radius of the circle.
Syntax:
circle(x,y,centre);
Program:
#include<conio.h> #include<graphics.h> #include<stdio.h>
void main() { int gd=DETECT,gm;
int x_centre,y_centre,radius; clrscr(); initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); printf("\n Please enter the centre coordinate of a circle = "); scanf("%d %d",&x_centre,&y_centre); printf("\n Now, \n Please enter the radius = "); scanf("%d",&radius); printf("\n***** CIRCLE ******"); circle(x_centre,y_centre,radius); getch(); closegraph();
}
Output:
This post was last modified on August 14, 2022