-------------------------------------------------------------------------------------------------------------------------------------
PROGRAM tekrar_sade
IMPLICIT NONE
!f(x)=(e**x)-x-4
!x=(e**x)-4
!g(x)=(e**x)-4
INTEGER::k
REAL::x,y,e,c,t,r1,r2,a,b
PRINT*,"baze [a,b] ra vared konid : "
PRINT*,"a = "
READ*,a
PRINT*,"b = "
READ*,b
t=(a+b)/2
r1=(2.71828182**t)-4
r2=2.71828182**t
IF ( ( r1 > a ) .and. ( r1 < b ) .and. (( ABS(r2)) < 1)) THEN
PRINT*
PRINT*,"nerkh hamgarayi ra vared konid : "
READ*,c
x=0
k=0
DO
k=k+1
y=(2.71828182**x)-4
e=(y-x)/y
IF ( e < c ) THEN
EXIT
ELSE
x=y
END IF
END DO
PRINT*,"javab dar tekrar",k," barabar : ",y
ELSE
PRINT*,"dar baze [",a,",",b,"] hich javabi vojood nadarad."
END IF
PRINT*
END