我的while条件出现错误,该怎么办?

问题描述

在这个程序中遇到很多麻烦 当两个连续数的除法与金黄色素比率之差小于10e-6时,该斐波那契数列应停止。 不幸的是,该程序会自动进入暂停状态,因此我认为我的while状态中正在发生某些事情。有什么建议吗?

program fibonacci
implicit none
integer::a,b,c,i
real::dif
real,parameter::e=10e-6,aurea=((1+sqrt(5.))/2.)
a=0;
b=1;
i=0;
dif=0;
do while (dif<e)
dif=abs((b/a)-aurea)
if (i==0) then
print*,a
else if (i==1) then
print*,b
else
c=a+b
print*,c
a=b
b=c
end if
end do
pause
end program fibonacci

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)