You are on page 1of 1

program biseccao

implicit none
real a,b,e,x,xb,f
integer k
print*, 'Insira o intervalo'
read*, a,b
print*, 'Insira o e'
read*, e

if ((b-a)<e) then
xb=(a+b)/2
print*, xb
go to 5
endif

k=1
3 x=(a+b)/2

if(f(a)*f(x)<0) then
b=x
else
a=x
endif

if ((b-a)<e) then
xb= (a+b)/2
print*, xb
go to 5
else
k=k+1
go to 3
endif

5 pause
end program

real function f(x)


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

You might also like