Question: I need help trying to match my output ( black ) with the correct output ( white ) using my code in C . Primes.c
I need help trying to match my outputblack with the correct outputwhite using my code in C
Primes.c
#include
#include
#include
#include "Primers.h
int randominrangeint lowerbound, int upperbound
return randupperbound lowerbound lowerbound;
void populateint arr int size, int lowerbound, int upperbound
forint i; i max
max curr;
return max;
float getrunningratio
float sumRatio ;
int maxPrimes ;
int iterationnumber ;
int numiteration randominrange;
for int j ; j numiteration; j
int size randominrange;
char arr char mallocsizeofchar size;
for int i ; i size; i
arri randominrange;
int primeCount getprimecountarr size;
float ratio floatprimeCount floatsize primeCount;
sumRatio ratio;
if maxPrimes primeCount
maxPrimes primeCount;
iterationnumber j;
freearr;
printfPrimes: Number of iterations is: d
numiteration;
printfPrimes: Iteration with MAX prime count: d
iterationnumber;
return sumRatio numiteration;
Drivers.c
#include "Primes.c
#include
#include
int mainint argc, charargv
int seed ;
if argc
seed atoiargv;
else
seed ;
printfDriver: Seeding RNG with seed: d
seed;
srandseed;
float avgRatio getrunningratio;
printfDriver: Average primecomposite ratio: f
avgRatio;
return EXITSUCCESS;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
