Given above is a C++ function that takes an integer n as a parameter and returns an integer. For a given input n, what does the function compute?
int fun(int n)
{
if(n==1)
return 1;
else if(n%2==0)
{
return n*fun(n-1);
}
else
return fun(n-1);
}
1
Factorial of a number
2
nn
3
Product of odd numbers till n (inclusive n)
4
Product of even numbers till n (inclusive n)
5
GCD of number