! M_TANTEO.

f90
!
! FUNCTIONS:
!
M_TANTEO
!

- Entry point of console application.

!****************************************************************************
!
! PROGRAM: M_TANTEO
!
! PURPOSE: Aplicar el metodo de Tanteo.
!
!****************************************************************************
program M_TANTEO
implicit none
! Variables
real x1, x2, y1, y2, Ax, Ep, s, xa, xf,fun
! Body of M_TANTEO
print*, 'ingrese x1'
read*, x1;
print*, 'ingrese x2'
read*, x2;
print*, 'ingrese Ep'
read*, Ep;
print*, 'ingrese Ax'
read*, Ax;
xf=x2
y1=fun(x1)
if (y1==0) then
print*, 'x1 es exacta', x1
else
do
x2= x1+Ax
y2= fun(x2)
s= y1*y2
if (s==0) then
print*, 'x2 es exacta', x2
exit
else

'no es un argumento valido' exit end if end if end if end do end if end program M_TANTEO real function fun(x) real x fun= x-(x*x)+sin(x) end function ! realizado por : Santiago Carranco .if (s<0) then if (Ax<Ep) then xa=(x1+x2)/2 print*.xa exit else Ax= Ax/10 end if else if (x2<=xf) then x1=x2 y1=y2 else print*. 'la raiz es ='.

Sign up to vote on this title
UsefulNot useful