You are on page 1of 1

program falsaposicao

implicit none
real a,b,e1,e1,xv,x,f
integer k
print*"Insira o intervalo"
read*, a,b
print*, ' Insira as precisäes '
read*. e1,e2
if ((b-a)<e1) then
x= (a+b)/2.
go to 1
endif
if (abs(f(a))<e2) then
xb=a
print*, xb
go to 1
endif
if(abs(f(b))<e2) then
xb=b
print*, xb
go to 1
endif
k=1
2 x=(a*f(b)-b*f(a))/(f(b)-f(a))
if (abs(f(x))<e2) then
xb=x
print*, xb
go to 1
endif
if (f(a)*f(b)<0 then
b=x
else
a=x
endif
if ((b-a)<e1) then
xb=(a+b)/2.
print*, xb
go to 1
endif
k=k+1
go to 2

1 pause
end program

real function f(x)


real x
f= x**3-9*x+3
return
end

You might also like