- #1
Daniel1992
- 22
- 0
Homework Statement
I need to write a program that, given the decay constant of a radioactive material, will calculate numerically (to withing one second) the time taken for half of the orginal sample of material to decay.
Homework Equations
λ = decay constant C0 = start amount of material
After one second C0 will have decayed leaving C = (1-λ)C0 of undecayed material left.
The Attempt at a Solution
I only have very basic experince at programming so I am finding this quite difficult. Below is the code that I have created so far.
IMPlICIT NONE
REAL :: y,C,t !y = decay constant C = starting amount of material t = time
PRINT*,"Enter decay constant"
READ*,y
PRINT*,"Enter starting amount of material"
READ*,C
DO WHILE (C.GT.C/2)
C=(1-y)*C
END DO
PRINT*,"C=",C
I don't really have any idea how I would work out hiw many interations the DO WHILE loop has done which i need to kno in order to work out the half life.
Any help/advice would be much appreciated.