how to draw a graph or histogram in c language
#define N 5
main()
{
intvalue[N];
int i, j, n, x;
for (n=0; n < N; ++n)
{
printf("Enter employees in Group - %d : ",n+1);
scanf("%d", &x);
value[n] = x;
printf("%d\n", value[n]);
}
printf("\n");
printf(" |\n");
for (n = 0 ; n < N ; ++n)
{
for (i = 1 ; i <= 3 ; i++)
{
if ( i == 2)
printf("Group-%1d |",n+1);
else
printf(" |");
for (j = 1 ; j <= value[n]; ++j)
printf("*");
if (i == 2)
printf("(%d)\n", value[n]);
else
printf("\n");
}
printf(" |\n");
}
}
Output
Enter employees in Group - 1 : 12
12
Enter employees in Group - 2 : 23
23
Enter employees in Group - 3 : 35
35
Enter employees in Group - 4 : 20
20
Enter Employees in Group - 5 : 11
11
|
|************
Group-1 |************(12)
|************
|
|***********************
Group-2 |***********************(23)
|***********************
|
|***********************************
Group-3 |***********************************(35)
|***********************************
|
|********************
Group-4 |********************(20)
|********************
|
|***********
Group-5 |***********(11)
|***********
|
Also in C:
- read a document in c getting name from console
- fseek function in c
- online python to c converter
- allocating memory for 1Mb text file in C
- C bitwise integer absolute value
- classification report to excel
- python web crawler
- write array of char to file in c
- uninstall elgg from hostgtor
- table fixed header
- deallocate memory in c
- how to ascii art in c
- strcpy c implementation
- unable to locate package dos2unix
- slurm array job
- statement o compare two strings in c
- powershell list big files
- WARNING: QA Issue: rdepends on
- bcopy
- 233 pounds to inr
- XAudio2 C
- how make a character in c scanf
- print integer to stdout using write or putchar?
- c printf right pad with space