120 views

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 | 120 views
+1

is it 22 times?

+1

similar question https://gateoverflow.in/8060/gate2015-2-11, see the approach

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

selected by

1
2