Thursday 11 March 2010

How can we find the output of recursion program in quicker way in c?




How can we find the
output of recursion program in quicker way in c programming language


(1)What will be output of following c recursion program?




#include
int main(){

    int x,num=4;

    x=call(num);

    printf("%d",x);

    return 0;



}

int call(int num){

    static int x=1,y;

    if(num>0){

         x=x*num;

         y=call(num-1)+call(num-2);

    }

    return x;

No comments:

Post a Comment