Psudo Code for Infosys off campus Recruitment

Psudo Code

What is the output of the following psudo code writeen in java. These type of questions are asked in various off campus recruitments like infosys,TCS,Wipro,HCL,Tech mahindra etc

public class problem21{

   static int funn(int a,int b){

        if(a<10 && b>1){

            return b+funn(a,b-1);
        }
    return a+1;
    }
    public static void main(String[] args) { 

    System.out.println(problem21.funn(2, 6));
    }
}

Answer for above code is : 23

Leave a Comment

Your email address will not be published. Required fields are marked *