4 ms·
Go! func factorial(x int) (result int) { if x == 0 { result = 1; } else { result = x * factorial(x - 1); } return; }
by Immortalin 11y ago
Go!
func factorial(x int) (result int) {
if x == 0 {
result = 1;
} else {
result = x * factorial(x - 1);
}
return;
}