void setup() {
int x = 5;
println(x + "! = " + factorialR(x));
} // setup()
long factorial (long n) {
long result = 1;
for (long i = n; i > 0; i--) {
result *= i;
}
return result;
} // factorial()
int factorialR(int n) {
if (n == 0) {
return 1;
}
else {
return n * factorialR(n - 1);
}
}