0
*C programming output*
#include<stdio.h> void foo(int, int); void main() { int a=2048; sum=0; foo(a, sum) printf("%d\n", sum); } void foo(int n, int sum) { int k=0, j=0; if(n ==0) return; k =n%10; j=n/10; sum=sum+k; foo(j,sum); printf("%d", k); } please explain the answer and meaning of statement :- return 0;
1 Answer
+ 1
#include<stdio.h>
void foo(int, int);
void main()
{
int a=2048;
int sum=0;
foo(a, sum);
printf("%d\n", sum);
}
void foo(int n, int sum)
{
int k=0, j=0;
if(n ==0) return;
k =n%10;
j=n/10;
sum=sum+k;
foo(j,sum);
printf("%d", k);
}