In this article, we will write a C Program to Draw Concentric Circles of Different Colors Using C Graphics. It is an important question which is asked in the exams and very important for students studying Computer Graphics.
We’ll learn the ideas behind this program before writing the C Program to Draw Concentric Circles of Different Colors Using C Graphics. Let’s go through the basics of C programming and C graphics, which we’ll be using in this tutorial.
C Program to Draw Concentric Circles of Different Colors Using C Graphics
Let’s start by learning the basics of C programming and graphics, and then write the C Program.
1. Concepts
The following concepts will be used in C Program to Draw Concentric Circles of Different Colors Using C Graphics. To develop this C program, you must understand these concepts.
- initgraph
- setcolor
- getmaxx
- circle
- getmaxy
- outtextxy
- closegraph
You should be able to comprehend the following C program after studying these concepts.
2. C Program to Draw Concentric Circles of Different Colors Using C Graphics
The C Program to Draw Concentric Circles of Different Colors Using C Graphics is as follows:
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main(){
int gd = DETECT,gm;
int x ,y;
initgraph(&gd, &gm, "C:\\TC\\BGI");
/* Center of Circle is initialized in the center of screen */
x = getmaxx()/2;
y = getmaxy()/2;
outtextxy(240, 50, "Concentric Circles");
/* Start drawing circles on screen */
setcolor(RED);
circle(x, y, 30);
setcolor(GREEN);
circle(x, y, 50);
setcolor(YELLOW);
circle(x, y, 70);
setcolor(BLUE);
circle(x, y, 90);
getch();
closegraph();
return 0;
}
3. Output

4. Resources
Here are the files used in this C Program to Draw Concentric Circles of Different Colors Using C Graphics. You can download these files to run on your own device or computer: