• edited by
1,325 views
1 1 vote

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")
        }
    }
}

1 Answer

Best answer
3 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
Position:
Show:

Related questions

1 1 vote
1 1 answer
735
735 views
SoloSword asked Nov 4, 2025
735 views
consider a rooted binary tree with n nodes represented using pointers. What is the best possible upper bound to compute the number of such subtrees , which are full binar...
2 2 votes
1 1 answer
735
735 views
Rajat Agrawal007 asked Dec 3, 2021
735 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 ?
0 0 votes
0 0 answers
1.0k
1.0k views
Ram Swaroop asked Jan 29, 2019
1,010 views
Consider the following C code:#include <stdio.h>struct MadeEasy{char p,q,r;};int main (void){struct MadeEasy a={ d' - 2019,'e',5+'a'};struct MadeEasy *b=&a;printf("%c, %c...
2 2 votes
1 1 answer
2.2k
2.2k views
Ram Swaroop asked Jan 29, 2019
2,196 views
Consider the following C code:include <stdio.h>int fun(){static int num=25;return num ;}int main(){for(fun( ); fun();fun())printf("%d", fun( ));return O;}The sum of the v...