//A recursive function to determine if an input is prime:
#include<iostream>
usingnamespace std;
bool isPrime(int p, int i);
int main() {
int p, i = 2;
cout<<"\nEnter a number: \n";
cin>> p;
cout << "Results: ";
cout<< isPrime(p, i);
}
bool isPrime(int p, int i)
{
if (i == p)
return 1; //or better if (i*i>p) return 1;
if (p % i == 0)
return 0;
elsereturn isPrime (p, i+1);
}