+ 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
2 Antworten
+ 3
Yes it's what I was mean. I've already used report for this quiz question, hope sololearn fix it🤔
+ 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