You are here

Circle function in c

Declaration: void circle(int x, int y, int radius);

Circle function is used to draw a circle with center (x,y) and third parameter specifies the radius of the circle. The code given below draws a circle.

C program for circle

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.  
  8.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  9.  
  10.    circle(100, 100, 50);
  11.    
  12.    getch();
  13.    closegraph();
  14.    return 0;
  15. }

In the above program (100, 100) are coordinates of center of the circle and 50 is the radius of circle.