Hello!
I have to write function Average, which has TWO PARAMETERS, array and int.
The same function has to:
1. find 5 prime numbers >= int,
2. make array_f[5] (RIGHT THOSE 5 prime numbers from (1).)
3. count average value of all 5 prime numbers (eements)
4, return that average value to main
I am trying to all possible ways,
the basic problem is how to put ALL THAT TO SAME FUNCTION???
I appoligise, am absolute beginner, and still have to practise with that!
Please, if smone can help!!!
MANY THANKS!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
using namespace std;
int Prime (int st)
{
if (st<2)
return 0;
int e = 1;
for (int i=2; i<st; i++)
{
if (st%i==0)
{
e = 0;
break;
}
}
return e;
}
|