C
Programming and Technical
Programming
Output
main()
{
int i=5;
printf("%d",foo(foo(foo(foo(foo(foo(i)))))));
}
void foo(int i)
{
if(i%2)
return (i*(5-4)+i);
else
return i-3;
}
Read Solution (Total 10)
-
- since its foo() return type is void so from foo nothing will return ...but the main function has retun type integer because when return type is not defined then by default it is of int type....but foo function for a function printf is true statement so it returns answer 1
- 9 years agoHelpfull: Yes(8) No(0)
- function foo should have a prototype...
it will give error. - 9 years agoHelpfull: Yes(2) No(1)
- Output : 22
- 9 years agoHelpfull: Yes(1) No(1)
- output:1
I also dont know why?
- 9 years agoHelpfull: Yes(1) No(0)
- 1
Void has not return any value
- 9 years agoHelpfull: Yes(1) No(0)
- 19 recursively return i*i
- 9 years agoHelpfull: Yes(0) No(1)
- 19 is the answer
- 9 years agoHelpfull: Yes(0) No(1)
- the ans is 0
- 9 years agoHelpfull: Yes(0) No(2)
- ans:38
explanation:
foo(5)=10 5%2=1 ->5+5
foo(10)=7
foo(7)=14 7%2=1 ->7+7
foo(14)=11
foo(11)=22 11%2=1 ->11+11
foo(22)=19
foo(19)=38 19%2=1 ->19+19 - 9 years agoHelpfull: Yes(0) No(1)
- ans will be .0
- 9 years agoHelpfull: Yes(0) No(1)
C Other Question