+ 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 Answers
+ 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
Hot today
Тренажер кода
1 Votes
Sololearn Bugged??
1 Votes
help my code does not iterate
0 Votes
How to install and update ?
0 Votes
What's wrong with this??
0 Votes