thats my code please help
Most of my problems are showing not shwoing anyputput just compiling
@chemant077 use this function for calculating the Euler toitent function
int phi(int n)
{
int result = n; // Initialize result as n
// Consider all prime factors of n and subtract their
// multiples from result
for (int p = 2; p * p <= n; ++p) {
// Check if p is a prime factor.
if (n % p == 0) {
// If yes, then update n and result
while (n % p == 0)
n /= p;
result -= result / p;
}
}
// If n has a prime factor greater than sqrt(n)
// (There can be at-most one such prime factor)
if (n > 1)
result -= result / n;
return result;
}
whats wrong with mine?
also its still not giving any output please help
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.