edited by
885 views
1 votes
1 votes

How many times made easy is printed?
#include <stdio.h>
int main() {
       c(4);
return 0;
}
int c(int m){
    if (m>0){
        for(int i=1;i<3;i++){
            c(m-i);
            c(m-i-1);
            printf("madeeasy")
        }
    }
}

edited by

1 Answer

Best answer
3 votes
3 votes

C(1) = for i=1, c(0) + c(-1) +pf() = 0+0+1=1 time madeeasy printed 

          for i=2, c(-1) + c(-2) + pf() = 0+0+1 =1 time madeeasy printed 

C(1) = 1+1 = 2

---------------------------------------------------------------------

C(2) = i=1, c(1) + c(0) +pf() = 2+0+1= 3 

          i=2, c(0) + c(-1) +pf() =0+0+1= 1 

C(2) = 3+1= 4

------------------------------------------------------------------------

C(3) = i=1, c(2) + c(1) + pf() = 4+2+1 = 7

          i=2, c(1) + c(0) +pf() = 2+0+1 =3

C(3) = 7+3 =10

-------------------------------------------------------------

C(4) = i=1, c(3) + c(2) + pf() = 10+4+1 =15

          i=2, c(2) + c(1) + pf() = 4+2+1 = 7

C(4) = 15+7 = 22 

 

Answer 22 times madeeasy printed 

selected by

Related questions

2 votes
2 votes
1 answer
1
Rajat Agrawal007 asked Dec 3, 2021
452 views
#include <stdio.h>int main(){ static int i = 6; if( i) { main(); printf("%d", i+1); } return 0;}Please explain the output of this program ?
2 votes
2 votes
1 answer
2
0 votes
0 votes
1 answer
3
Markzuck asked Jan 10, 2019
530 views
Please explained detialed execution of this code, I am not getting how int stored in char, like we can interchange using ASCII but still cant store right?