Feynman
06-28-2007, 10:08 AM
Good morning,
I m a beginner on the fortran,
I write a program to calculate the sum from i=1 to n of 1/i!
and i have one error, but i don t know how to delete these error, could you help me?
thank you
this is my program :
program expo
implicit none
integer n,j
real sum
print* ,'entrer le nombre n:'
read*,n
sum=0.0
do j=1,n
sum=sum+1/fact(j)
end do
end
function fact(m)
integer fact, m, p
p = 1
do i = 1, m
p = p * i
end do
fact = p
end function fact
I m a beginner on the fortran,
I write a program to calculate the sum from i=1 to n of 1/i!
and i have one error, but i don t know how to delete these error, could you help me?
thank you
this is my program :
program expo
implicit none
integer n,j
real sum
print* ,'entrer le nombre n:'
read*,n
sum=0.0
do j=1,n
sum=sum+1/fact(j)
end do
end
function fact(m)
integer fact, m, p
p = 1
do i = 1, m
p = p * i
end do
fact = p
end function fact