• closed by
909 views
0 0 votes
closed as a duplicate of: GATE CSE 1999 | Question: 2.24

 Consider the following C function definition:

int Trial (int a, int b, int c) 
{ 
   if ((a > = b) && (c < b)) return b; 
   else if (a > = b) return Trial (a,c,b); 
   else return Trial (b,a,c); 
}

The function Trial:  
(a) Finds the maximum of a, b, and c 
(b) Finds the minimum of a, b and c 
(c) Finds the middle number of a, b, c 
(d) None of the above  

I am getting c as an answer if a,b,c are distinct ,but if for example all the no. are same it will fall into an infinite loop ,The answer given in book is c.

Position:
Show:

No related questions found