发布网友 发布时间:2022-04-24 18:33
共2个回答
热心网友 时间:2023-11-01 20:48
“real f(x)”有这样定义函数的么?
program lin182838
implicit none
real x,a,b,c,wc
real fa,fc
print*,"Please put in the two numbers between which you guess the outcome is"
read*,a,b
wc=5
do while (b-a<wc)
c=(b-a)/2
fa=f(a)
fc=f(c)
if (fa * fc <0) then
b=c
else
a=c
end if
end do
write(*,*) a
contains
real function f(x)
real::x
f= x*x-2*x-7
end function
热心网友 时间:2023-11-01 20:49
最后少个end和program对应,漏贴了,呵呵