Hi,
well i have a userinput for an integer. And i have to get sqrt of that number and find the closes number from array... and i dont rly know how to do that... can anyone help?
heres the part for my input:
and here's the function i use to fill in the array with prime numbers,.. etc...so this function also has to return the closest number from the array to the sqrt of the inputed integer...
Hope anyone can help me :)
well i have a userinput for an integer. And i have to get sqrt of that number and find the closes number from array... and i dont rly know how to do that... can anyone help?
heres the part for my input:
Code:
int poljubnostevilo; cin >> poljubnostevilo; cout <<endl; int koren = sqrt (poljubnostevilo); cout << koren << endl;
Code:
int funkcijatri(int x, int n){
n = 4;
int praarray[x];
int a=0;
int sum;
while(a<x){
n++;
if(IsPrime(n) && (n>=a)){
praarray[a] = n;
cout << praarray[a] << ", ";
sum+= praarray[a];
a++;
}//konec if
}//konec while
return sum/x;
}