-
Notifications
You must be signed in to change notification settings - Fork 0
/
CONC.C
55 lines (48 loc) · 1.18 KB
/
CONC.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// A program to draw concentric shapes.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void mycircle();
void myrectangle();
void mytriangle();
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
outtext("This is a program to draw shapes within shapes");
//calling the 3 shapes
mycircle();
myrectangle();
mytriangle();
getch();
closegraph();
}
void mycircle()
{
int i,x=80,y=100,r=10;
setcolor(RED); //sets the outline colour RED
for(i=0;i<=60;i+=10) //each circle having a difference of radius 10p
{
circle(x,y,r+i);
}
}
void myrectangle()
{
int i,x1=50,y1=200,x2=280,y2=330;
setcolor(GREEN); //sets the outline colour GREEN
for(i=0;i<=60;i+=10)//each rectangle having a difference of length 10p
{
rectangle(x1+i,y1+i,x2-i,y2-i);
}
}
void mytriangle()
{
int i,x1=230,y1=30,x2=310,y2=170,x3=150,y3=170;
setcolor(BLUE); //sets the outline colour GREEN
for(i=0;i<=60;i+=10) //each rectangle having a difference of length 10p
{
line(x1,y1+i,x2-i,y2-i); //right arm of the triangle
line(x2-i,y2-i,x3+i,y3-i);//base of the triangle
line(x3+i,y3-i,x1,y1+i); //left arm of the triangle
}
}