0

What is the output of this code.

static int Fact(int num) { if (num == 5) { return 5; } return num * Fact(num - 120); }

5th Feb 2017, 2:34 AM
Christopher
1 Answer
+ 4
To keep the answer simple, if num=125, then output will be 625. Or if num equals some (x +125), you'll get a definite output. Otherwise it goes into infinite loop.
5th Feb 2017, 4:26 AM
Manthan Raja
Manthan Raja - avatar