fork download
  1. PROGRAM Radioactive_Decay
  2. Friedel Pretorius
  3. !----------------------------------------------------------------------------
  4. ! This program calculates the amount of a radioactive substance that
  5. ! remains after a specified time, given an initial amount and its
  6. ! half-life. Variables used are:
  7. ! InitalAmount : initial amount of substance (mg)
  8. ! HalfLife : half-life of substance (days)
  9. ! Time : time at which the amount remaining is calculated (days)
  10. ! AmountRemaining : amount of substance remaining (mg)
  11. !
  12. ! Input: InitialAmount, HalfLife, Time
  13. ! Output: AmountRemaining
  14. !-----------------------------------------------------------------------------
  15.  
  16. IMPLICIT NONE
  17. REAL :: InitialAmount, HalfLife, Time, AmountRemaining
  18.  
  19. ! Get values for InitialAmount, HalfLife, and Time.
  20.  
  21. Write (*,*) "Enter initial amount (mg) of substance, its half-life (days)"
  22. Write (*,*) "and time (days) at which to find amount remaining:"
  23. READ (*,*) InitialAmount, HalfLife, Time
  24.  
  25. ! Compute the amount remaining at the specified time.
  26. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife)
  27.  
  28. ! Display AmountRemaining.
  29. Write (*,*) "Amount remaining =", AmountRemaining, "mg"
  30.  
  31. END PROGRAM Radioactive_Decay
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.f95:2:

Friedel Pretorius
1
Error: Unclassifiable statement at (1)
stdout
Standard output is empty