retagged by
597 views

2 Answers

3 votes
3 votes

$i = 5$

Intially $5$ is printed, $i$ becomes $4$

if(4) is true, main() is called, $4$ is printed, $i$  becomes $3$

If(3) is true, main() is called, $3$ is printed, $i$ becomes $2$

if(2) is true, main() is called, $2$ is printed, $i $ becomes $1$

if(1) is true, main() is called, $1$ is printed, $i $ becomes $0$

If(0) is false, all function calls returns.

Hence 54321 is printed

0 votes
0 votes

WE use static variable and inside printf we use post decrement opertor  which is first print the value then decrement the value of i.

Related questions

4 votes
4 votes
1 answer
1
dragonball asked May 2, 2017
2,284 views
main() { int c=0,x,i,y; for(i=0;i<N;i++) { x=random();y=random(); if((x2+y2)<1) c++; } print(c); }random() is a function which returns random number b...
3 votes
3 votes
0 answers
2
Tesla! asked Apr 22, 2018
690 views
In a min-heap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time$\Theta (n \log n)$$\Theta (n)$$\Theta(\log n)$$\...
2 votes
2 votes
0 answers
3