196 views
0 votes
0 votes
Predict the output of the following program. 
Void func (int n)
{
if (n > o)
{
func (n – 2);
Print f ("% d", n – 1);
Fun (n – 2);
}
}
if 10 is passed as literal value :
(1) 975921
(2) 951351
(3) 1315131713151317
(4) 131513713151319131513171315131

Your Answer:

3

Correct Answer: 4    Status: incorrect

1 Answer

1 votes
1 votes
Yes 4th option is correct, There has to be 9 in the middle as we have passed 10 initially so one recursion is for func(10-2) than printf(10-1) than same recusrion for func(10-2) hence option 4th.

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2