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

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation