Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Question1(b)
program false implicit none real::a,b,f,x,tol,xv integer::itrtn,i print*, "Enter the initial values (a,b):" read(*,*)a,b if( (f(a)*f(b)) .gt.0) then write(*,*)"Can not be done", f(a), f(b); stop end if print*, "Enter the number of iteration:" read(*,*)itrtn print*, "Enter the tolerance:" read(*,*)tol do 10 i = 1, itrtn xv = (a * f(b) - b* f(a)) / (f(b)-f(a)) if(f(xv).eq.0) then print*,"The soln is: ",xv stop end if if(f(a)*f(xv).le.0) then b = xv print*,a,b else a = xv print*,a,b end if if(abs(a-b).le.tol) then print*, "The approximate soln is: ",xv stop end if 10 continue print*,"Maximum iteration failed" end program real function f(x) real::x f = x**3 - 2*x -5 return end function
run
|
edit
|
history
|
help
0
A_02 QUESTIONS NUMBER 3
SIUM(3.5)
Backward
euler-cromer
Adams-Bashforth Method for four step
Comparison of three numbers
Sudoku
SUM OF ODD NUMBERS
Fib series
Sum 1 to 99 divided by 12 to 100