I am writing a code for asking a user for a number between 3 and 100, and determining if its prime. I have 90% of the code written, and it works but I am struggling with an equation for determining if a number is prime. Below is what i currently have:
int isprime (int num) {
int answer;
answe = (num/num);
return answer;
}
int main () {
int num;
cin>> num;
int answer;
cout<< Please enter a number between 3 and 100";
answer = isprime(num);
cout<< num;
cout<< endl;
if (answer ==1) {
cout<< "is prime";
cout<< endl;
}
else {
cout<< "is not prime";
cout<< endl;
}
return 0;
}