841 views
0 votes
0 votes

How 22 ?

2 Answers

Best answer
1 votes
1 votes
$code(0)\rightarrow ME$ will print $0$ times

$code(1)\rightarrow{\color{Blue} {i=1}}$${\color{Purple} {----------\rightarrow }{code(0)}}$

                                   ${\color{Purple} {----------\rightarrow }{code(-1)}}$

                                   ${\color{Purple} {----------\rightarrow }{ME}}$

 

 

                            ${\color{Blue} {i=2}}$${\color{Purple} {----------\rightarrow }{code(-1)}}$

                                   ${\color{Purple} {----------\rightarrow }{code(-2)}}$

                                   ${\color{Purple} {----------\rightarrow }{ME}}$

 

So, for $code(1)$ $ME$ will print $2$ times

 

 

$code(2)\rightarrow{\color{Blue} {i=1}}$${\color{Purple} {----------\rightarrow }{code(1)}}$$\rightarrow$$ME$ prints $2$ times

                                   ${\color{Purple} {----------\rightarrow }{code(0)}}$

                                   ${\color{Purple} {----------\rightarrow }{ME}}$

 

 

                            ${\color{Blue} {i=2}}$${\color{Purple} {----------\rightarrow }{code(0)}}$

                                   ${\color{Purple} {----------\rightarrow }{code(-1)}}$

                                   ${\color{Purple} {----------\rightarrow }{ME}}$

 

So, for $code(2)$ $ME$ will print $4$ times

 

Similarly $code(3)$ will print $ME$ $10$ times

 

and $Code(4)$ will print $ME$ $22$ times
selected by
1 votes
1 votes

Ans is 22

Related questions

0 votes
0 votes
2 answers
1
Debargha Mitra Roy asked Apr 10
121 views
What is the output of the below code?#include <stdio.h void main() { static int var = 5; printf("%d ", var ); if (var) main(); }a. 1 2 3 4 5b. 1c. 5 4 3 2 1d. Error
3 votes
3 votes
3 answers
2
Laxman Ghanchi asked May 19, 2023
1,177 views
#include<stdio.h void print(int n) { printf("Hello "); if(n++ == 0) return ; print(n); n++; } int main() { void print(); print(-4); }How many times printf execute?? And H...
0 votes
0 votes
1 answer
3
Laxman Ghanchi asked May 19, 2023
693 views
#include<stdio.h>void print(int n){ printf("Hello "); if(n++ == 0) return ; print(n); n++;}int main(){ void print(); print(-4);}