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 :
! 		InitialAmount			: 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.

	PRINT *, "Enter initial amount (mg) of substance, its half-life (days)"
	PRINT *, "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"

	pause
END PROGRAM Radioactive_Decay
 
 
 

'노트 > Fortran 연습' 카테고리의 다른 글

Program 3.4. 오염지수 3  (0) 2014.04.06
Program 3.3. 오염지수 2  (0) 2014.04.06
Program 3.2. 오염지수  (0) 2014.04.06
Program 3.1. 이차 방정식  (0) 2014.04.06
Program 2.Exercise6.2. 온도 변환 (2nd Version)  (0) 2014.03.23
Program 2.Exercise6.1. 온도 변환 (1st Version)  (0) 2014.03.23
Program 2.Exercise5  (0) 2014.03.23
Program 2.1. 발사체 문제  (0) 2014.03.22
Program 1.Exercise10  (0) 2014.03.22
Hello World  (0) 2014.03.04

+ Recent posts