// prime-div-v1.cpp // "dangling else" problem solved #include #include "../isPrime/isPrime-fn2.h" //for isPrime(n) using namespace std; int main() { int n, pd; //n, possible divisor of n //prompt and read cout << "enter n & possible divisor of n: "; cin >> n >> pd; //test: is pd a prime divisor of n? if(n % pd == 0) if(isPrime(pd)) cout << endl << pd << " is a prime divisor of " << n << endl; else cout << endl << pd << " is a divisor of " << n << endl; else cout << endl << pd << " is not a divisor of " << n << endl; cout << endl << "Exiting.." << endl; return 0; }