engineering recuitment GATE CSE 2023-24 Test Series Programming and Data Structure Programming in C Function Recursion
What is the output of the function fun(-1 + 2419)?
#include
int fun(int n)
{
if (n == 0)
return 0;
int temp = n % 10 + fun(n / 10);
if(temp>9)
return fun(temp);
else
return temp;
}
int main() {
printf("%d",fun(-1 + 2419));
return 0;
}
1
15
2
6
3
-1
4
Error