ExamVeda
Login
Home
Miscellaneous on Data Structures
?

What will be the output of the following code in C++?
#include <stdio.h> 
int ETF(int n) 
{ 
    int a, result = n; 
    for (a = 2; a * a <= n; ++a)
    { 
        if (n % a == 0)
	{ 
	    while (n % a == 0) 
                n = n / a; 
	    result = result - result / a; 
	} 
    } 
    if (n > 1) 
        result = result - result / n; 
    return result; 
} 
int main() 
{ 
    int n; 
    for (n = 1; n <= 4; n++) 
        printf("%d\n", ETF(n)); 
    return 0; 
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.