C program to draw ellipses and arcs

Complete C program to draw ellipses and arcs

#include<graphics.h> 
#include<conio.h> 
void main() 
{ 
int gd=DETECT; 
int gm; 
initgraph(&gd,&gm,””); 
setcolor(1); /*sets the drawing color as blue*/ 
ellipse(getmaxx()/2, getmaxy()/2,0,360,80,50); 
 /*draws an ellipse taking center of the screen as its center, 0as starting angle 
and360 as ending angle and 80 pixels as x-radius, 50 pixels as y radius*/ 
setcolor(4); /*sets the drawing color as red*/ 
ellipse(getmaxx()/2, getmaxy()/2, 90,270,50,80); 
 /*draws half the ellipse starting from 90 degree angle and ending at 270 
degree with 50 pixels as x-radius and 80 pixels as y-radius in red color*/ 
setcolor(5); /*sets the drawing color as pink */ 
arc(getmaxx()/2, getmaxy()/2, 0, 180, 100); 
 /*arc with center of the screen as its center and 100 pixels as radius. It starts 
at an angle 0 and ends at an angle 180 degrees, i.e., half circle*/ 
setcolor(9); /* sets the drawing color as light blue */ 
arc(300,200,20,100,70) ;
/*arc with (300,200) as its center and 70 pixels as radius. It starts at an angle 
20 and ends at an angle 100 degrees*/ 
getch(); 
closegraph(); /* closes the graph mode */ 
} 

Leave a Comment