Interview Questions

Find output of the following code......

Software QA/Tests Interview Questions from Microsoft


(Continued from previous question...)

Find output of the following code......

Question:
Find output of the following code

int
mingle(int a, int b)
{
int c = b/2;
if (b<=1) { return a;}

cout<<c <<endl;
return a*(b-2*c) + mingle(a,c);

}

int
main()
{
int i;
for (i = 1; i<=5 ; i++) {
cout<<mingle(i+1,i-1)<<endl;
}
return 0;
}



maybe an answer:


2
3
1
4
1
10
2
1
6



maybe an answer2:


2
3
1
4
1
10
2
1
30

(Continued on next question...)

Other Interview Questions