|
|
xxxxxxxxxxxxxxxxxx |
program demofactorial
c This program evaluates factorials. The user inputs an integer,
c and a function subprogram computes its factorial.
integer fact, n
print *, "What is your integer n?"
read*, n
print *, "The value of", n, " factorial is", fact(n)
print *, "See you!"
end
function fact(n)
integer fact, n, p
p = 1
do i = 1, n
p = p * i
end do
fact = p
end
|