10 lines
256 B
Text
10 lines
256 B
Text
real factorial(int n) {
|
|
real f = 1;
|
|
for (int i = 2; i <= n; ++i)
|
|
f = f * i;
|
|
return f;
|
|
}
|
|
|
|
write("The factorials for the first 5 positive integers are:");
|
|
for (int j = 1; j <= 5; ++j)
|
|
write(string(j) + "! = " + string(factorial(j)));
|