in Programming
184 views
0 votes
0 votes
#include<stdio.h>
int code(int m){
    if(m>0){
        int i=1;
        for(;i<3;i++){
            code(m-i);
            code(m-i-1);
            printf("GATE2019");
        }
    }
}
int main()
{
    code(4);
    return 0;
}

How many times GATE2019 will be printed?

in Programming
by
184 views

4 Comments

how? Any easy way?
0
0
now got 21

code(3)=9 times

code(2)=4 times

code(1)=2 times

Now for i=1=>14 times

and i=2 =>7 times

where is mistake?
0
0
1
1

Please log in or register to answer this question.

Related questions