主题:新手求助,迭代过程的错误,很简单的改错
recursive integer function fibonacci(i) result(answer)
implicit none
integer,intent(in):: i
if(i==0) then
answer=0
else if(i==1) then
answer=1
else
answer=fibonacci(i-1)+fibonacci(i-2)
end if
end function fibonacci
program Console9
implicit none
integer::n,i
integer::fibonacci
print "(A)","print the number of series you want"
read(*,*) i
do i=0,i
print *,fibonacci(i)
end do
end program Console9
错误显示如下:
错误 1 error #6633: The type of the actual argument differs from the type of the dummy argument. D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 23
错误 2 error #6633: The type of the actual argument differs from the type of the dummy argument. [I] D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 35
错误 3 Compilation Aborted (code 1) D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 1
implicit none
integer,intent(in):: i
if(i==0) then
answer=0
else if(i==1) then
answer=1
else
answer=fibonacci(i-1)+fibonacci(i-2)
end if
end function fibonacci
program Console9
implicit none
integer::n,i
integer::fibonacci
print "(A)","print the number of series you want"
read(*,*) i
do i=0,i
print *,fibonacci(i)
end do
end program Console9
错误显示如下:
错误 1 error #6633: The type of the actual argument differs from the type of the dummy argument. D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 23
错误 2 error #6633: The type of the actual argument differs from the type of the dummy argument. [I] D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 35
错误 3 Compilation Aborted (code 1) D:\study\研二第一学期\fortran\Console9\Console9\Console9.f90 1