-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9.c
More file actions
48 lines (35 loc) · 662 Bytes
/
9.c
File metadata and controls
48 lines (35 loc) · 662 Bytes
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
//9. WAP to draw Bar Chart.
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd = DETECT , gm , i, b=120 ;
float x[3] , y=0.0 , a[3];
initgraph(&gd,&gm,"C:/turboc3/bgi");
clrscr();
printf("Enter the population of 3 countries\n");
for(i=0;i<3;i++)
{
scanf("%f",&x[i]);
}
y=x[0]+x[1]+x[2];
line(100,400,400,400);
line(100,100,100,400);
settextstyle(0,1,2);
outtextxy(100,200,"POPULATION");
settextstyle(0,0,2);
outtextxy(100,400,"STATES");
outtextxy(50,420,"(100,400)");
for(i=0;i<3;i++)
{
a[i]=400-((x[i]/y)*300);
}
for(i=0;i<3;i++)
{
bar(b,a[i],b+30,400);
b=b+60;
}
getch();
closegraph();
}