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;

18th Oct 2019, 3:00 PM
Shivansh Mathur
Shivansh Mathur - avatar
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); }
18th Oct 2019, 4:46 PM
id001x
id001x - avatar