1) int foo(int x)
{
if(x<=0)
return 0;
else
return 1+foo(x/10);
}
a) What is the output of this logic for foo(12345)
b) What purpose this logic is used
c) If we give negative number what output will get. If u future enhance n find a bug, how u change the code to fix the bug n the remain work for negative n positive numbers.
{
if(x<=0)
return 0;
else
return 1+foo(x/10);
}
a) What is the output of this logic for foo(12345)
b) What purpose this logic is used
c) If we give negative number what output will get. If u future enhance n find a bug, how u change the code to fix the bug n the remain work for negative n positive numbers.
Comment