#include <stdio.h>
//階乗計算を再帰を用いて行う
int factorial(int n){
if (n == 1){
return 1;
}
else{
return n+factorial(n-1);
}
}
int main(void) {
int n = 3;
printf("1から%dまでの積は%d\n", n
, factorial
(n
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8v6ZqO5LmX6KiI566X44KS5YaN5biw44KS55So44GE44Gm6KGM44GGCmludCBmYWN0b3JpYWwoaW50IG4pewogICAgaWYgKG4gPT0gMSl7CglyZXR1cm4gMTsKICAgIH0KICAgIGVsc2V7CglyZXR1cm4gbitmYWN0b3JpYWwobi0xKTsKICAgIH0KfQoKaW50IG1haW4odm9pZCkgewogICAgaW50IG4gPSAzOwogICAgcHJpbnRmKCIx44GL44KJJWTjgb7jgafjga7nqY3jga8lZFxuIiwgbiwgZmFjdG9yaWFsKG4pKTsKCXJldHVybiAwOwp9Cg==