Program bacterial_growth !------------------------------------------------------------------------------ !Program: Bacterial Growth !Author: Chris Harper !Date: 2/10/2008 !------------------------------------------------------------------------------ IMPLICIT NONE !declarations integer :: max, gen real :: count, last_count, rate !get input print *, "Enter the starting bacteria count:" read *, count print *, "Enter the rate of growth as a decimal percentage (ex. 0.95):" read *, rate print *, "Enter the max bacteria count:" read *, max !output table headings print "(A4, 6X, A11, 13X, A5)", "Gen.", "Count Delta", "Count" !setup and print the first generation gen = 1 print 20, gen, 0, int(count) 20 format(I4, T6, I16, T24, I16) !loop through subsequent generations until count > max by only one generation do last_count = count count = count + (count * rate) gen = gen + 1 !count and delta are truncated because there cannot be fractional numbers of bacteria print 20, gen, (int(count) - int(last_count)), int(count) if (count > max) exit enddo end