The Program in C to Draw Ellipse or Circle is given below:
#include <graphics.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
int x = 300, y = 200, rx = 100, ry = 50;
setcolor(RED);
ellipse(x, y, 0, 360, rx, ry);
getch();
closegraph();
return 0;
}
Output:
*It Draws an ellipse on your screen
Pro-Tips💡
This program uses the “ellipse” function from the “graphics.h” library to draw an ellipse.
It takes the x-coordinate, y-coordinate, start angle, end angle, and horizontal and vertical radius of the ellipse as its parameters.
the “initgraph” function initializes the graphics system and takes the graphics driver, graphics mode, and path of the driver as its parameters.
“getch” function is used to hold the output screen until a key is pressed and “closegraph” function closes the graphics mode.
Learn C-Sharp ↗
C-sharp covers every topic to learn about C-Sharp thoroughly.
Learn C Programming ↗
C-Programming covers every topic to learn about C-Sharp thoroughly.
Learn C++ Programming↗
C++ covers every topic to learn about C-Sharp thoroughly.