+ 3

Zero factorial equal one

In some tests, this well-known fact is ignored. For example: Fill in the blanks to get a function calculating factorial: int fact(int n) { if (n==__) return 1; return __*fact(__-1); } If the first blank I write 1, answer will be accepted as correct. But then one case (0!) is lost

15th Jan 2018, 6:19 PM
LimitWolf
LimitWolf - avatar
2 Answers
+ 3
Yes it's what I was mean. I've already used report for this quiz question, hope sololearn fix it🤔
16th Jan 2018, 12:46 PM
LimitWolf
LimitWolf - avatar
+ 1
Fill in the blanks to get a function calculating factorial: int fact(int n) { if (n==0) return 1; return n*fact(n-1); } when you write n == 0 it will return 1. How can you say 0! lost. If the first blank I write 1, answer will be accepted as correct. But then one case (0!) is lost
16th Jan 2018, 1:33 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar