0

What will the function Strange(20,5) will return?

int Strange(int x,int y) { if(x>=y) { x=x-y; return Strange(x,y); } else return x; }

18th Dec 2019, 2:11 PM
Naman Pandey
Naman Pandey - avatar
1 Resposta
+ 1
it is equivalent to x%y (as you are substracting y from x some n(x/y) number of times till x not become -ve), so it will return 20%5 which is 0
18th Dec 2019, 2:34 PM
Gaurav Agrawal
Gaurav Agrawal - avatar