1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | PROGRAM Radioactive_Decay !---------------------------------------------------------------------------- ! This program calculates the amount of a radioactive substance that ! remains after a specified time, given an initial amount and its ! half-life. Variables used are: ! InitalAmount : initial amount of substance (mg) ! HalfLife : half-life of substance (days) ! Time : time at which the amount remaining is calculated (days) ! AmountRemaining : amount of substance remaining (mg) ! ! Input: InitialAmount, HalfLife, Time ! Output: AmountRemaining !----------------------------------------------------------------------------- IMPLICIT NONE REAL :: InitialAmount, HalfLife, Time, AmountRemaining ! Get values for InitialAmount, HalfLife, and Time. write(*,*) "Enter initial amount (mg) of substance, its half-life (days)" write (*,*) "and time (days) at which to find amount remaining:" READ *, InitialAmount, HalfLife, Time ! Compute the amount remaining at the specified time. AmountRemaining = InitialAmount * 0.5 ** (Time / HalfLife) ! Display AmountRemaining. PRINT *, "Amount remaining =", AmountRemaining, "mg" END PROGRAM Radioactive_Decay |
UFJPR1JBTSBSYWRpb2FjdGl2ZV9EZWNheQohLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQohIFRoaXMgcHJvZ3JhbSBjYWxjdWxhdGVzIHRoZSBhbW91bnQgb2YgYSByYWRpb2FjdGl2ZSBzdWJzdGFuY2UgdGhhdCAKISByZW1haW5zIGFmdGVyIGEgc3BlY2lmaWVkIHRpbWUsIGdpdmVuIGFuIGluaXRpYWwgYW1vdW50IGFuZCBpdHMgCiEgaGFsZi1saWZlLiAgVmFyaWFibGVzIHVzZWQgYXJlOgohICAgSW5pdGFsQW1vdW50ICAgIDogaW5pdGlhbCBhbW91bnQgb2Ygc3Vic3RhbmNlIChtZykKISAgIEhhbGZMaWZlICAgICAgICA6IGhhbGYtbGlmZSBvZiBzdWJzdGFuY2UgKGRheXMpCiEgICBUaW1lICAgICAgICAgICAgOiB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result: Success time: 0.01s memory: 2620 kB returned value: 0
21 12 32
Enter initial amount (mg) of substance, its half-life (days) and time (days) at which to find amount remaining: Amount remaining = 3.3072925 mg
-
result: Runtime error time: 0.02s memory: 2620 kB signal: -1
19 32 15
Enter initial amount (mg) of substance, its half-life (days) and time (days) at which to find amount remaining:
At line 22 of file prog.f95 (unit = 5, file = 'stdin') Fortran runtime error: End of file
look for extra credit



