write a c program to solve the following problem Upload your

write a c program to solve the following problem. Upload your source code file to Canvas. The file name must be of the form hwarray your name.c substitute your first and last name for your name\" in the file name. Example: Student\'s name is Sparky watts. The file name is hwarray sparky watts-c Problem Statement Create a program that displays a frequency histogram. The program output should closely resemble the example output shown below. CAUsersDianelDesktophistogrambinNDebughistogram.exe Histo gran Group 0 Group Group 2 Group 3: Group 4: Group S: Group 6 Group 7: up 8 Group 9 Most frequent nunber: 29. occurs 5 times Process returned 0 (0x0) execution tine 0.570 s Press any key to continue. The above output represents a count of generated random numbers. The range of random numbers is [0,99], inclusive. In the above example, 150 random numbers were generated. The data is split into 10 equal groups. Range Group Range [50, 59] [0,9] [60, 69] 19] [70, 79] 120, 29]

Solution

#include <stdio.h>
#include <stdlib.h>
#define SIZE 10

int main(void)
{
srand(time(NULL));
int k,num;
for(k=0;k<150;k++){
num = 1 + rand()%99;
   printf(\"%d\ \",num);
  
}
   int n[SIZE] = {9, 3, 15, 7, 1, 9, 13, 5, 17, 1};
   int i, j;
   // display the table header...
   printf(\"%s%13s%17s\ \",\"Element/index\", \"Value\", \"Histogram\");
   // do the iteration, outer for loop, read row by row...
   for(i=0; i <= (SIZE-1); i++)
   {
       printf(\"%9d%15d \", i, n[i]);
       // inner for loop, for every row, read column by column and print the bar...
       for(j = 1; j<= n[i]; j++)
       // print the \'bar\', and repeat...
       printf(\"*\");
       // go to new line for new row, and repeats...
       printf(\"\ \");
   }
   return 0;
}

 write a c program to solve the following problem. Upload your source code file to Canvas. The file name must be of the form hwarray your name.c substitute your

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site