Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
! Author: Xiaofeng Chen, [email protected]
! Course: CSE 4250, Fall 2017
! Project: project #1, Spread of Epidemics
!https://www.tutorialspoint.com/fortra/fortran_do_while_loop.htm
!helps a lot about the basic of fortran
program mymain
implicit none
real :: n,alp,ga,wn,a,w = 0, cond = 1, e = 2.71828, result
print*,"Enter n and alpha"
read(*,*) n,alp
do while(cond >= 0.001)
wn = w - ((w*(e**w))-(-alp*(e**(-alp)))) / ((w+1)*(e**w))
cond = abs(w-wn)
w = wn
end do
a = w / alp
ga = 1 + w / alp
result = ga * n
if (result - int(result) < 0.5) then
print*, int (result)
else
print*, int (result+1)
end if
end program mymain
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more