階乗
2007/09/16
java
poj
Cozy Ozy - Sum of Factorials(1)
1775 -- Sum of Factorials
階乗の計算
static int factorial(int n) {
int r = 1;
// for (int i = 1; i <= n; i++) {
// r = r * i;
// }
for (r = 1; n != 0; r *= n--)
;
return r;
}
int r = 1;
// for (int i = 1; i <= n; i++) {
// r = r * i;
// }
for (r = 1; n != 0; r *= n--)
;
return r;
}
: