Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ok i have this code and i want to do the following: Write a function that reads

ID: 3697284 • Letter: O

Question

ok i have this code and i want to do the following:
Write a function that reads the data from the previous file UniFile.csv and saves it in an array
as input. The function should compute the histogram of distributions of the integers from the previous
data. A histogram is an array that contains counters for the number of occurrences of each of the
values of the input array.(i have 2 files UNIFILE.csv and Histogram.csv)

this is my code

#include
#include
#include
#include

int main(void)
{
   FILE *outfile,*infile;
   int r,x,max,min,ns;
  
   outfile = fopen("UniFile.csv", "w");
   printf("Enter Number of times :");
   scanf("%d",&ns);
  
printf("Enter a Maximum and a Minimum value:");
scanf(" %d %d",&min,&max);
   for(r=0;r    {
       x = min + ((max-min)*rand()/(double)RAND_MAX);
       printf("%d ", x);
       fprintf(outfile, "%d ", x);
   }
   fclose(outfile);
  
   infile = fopen("UniFile.csv","r");
  
    return 0;
}

Explanation / Answer

#include
#include
#include
#include

int main(void)
{
   FILE *outfile,*infile;
   int r,x,max,min,ns;
  
   outfile = fopen("UniFile.csv", "w");
   printf("Enter Number of times :");
   scanf("%d",&ns);
  
printf("Enter a Maximum and a Minimum value:");
scanf(" %d %d",&min,&max);
   for(r=0;r    {
       x = min + ((max-min)*rand()/(double)RAND_MAX);
       printf("%d ", x);
       fprintf(outfile, "%d ", x);
   }
   fclose(outfile);
  
   infile = fopen("UniFile.csv","r");
  
    return 0