0

```
//Hi all,can you explain how to call this function in main.
//i ask user to enter the number,like this is it correct in main,recursevely call function?
bool isPrime(int n, int d);
int main()
{
int number;
cout <<"Enter number >= 1";
cin >> number;
if(isPrime(number))
{
return
cout << "Yes";
else
return
cout << "No";
}
return 0;
}
bool isPrime(int n, int d)
{
if(n<2)
return 0;
if(d == 1)
return true;
else
{
if(n % d == 0)
return false;
else
return isPrime(n, d - 1);
}
}
```

*Edited 2 Years Ago by aluhnev*