fork download
  1. Program PopulationGrowth
  2. !----------------------------------------------------------------------
  3. !Tyler Martin Engr225 Lab 2 25 January 2012
  4. ! Population Growth Model
  5. !----------------------------------------------------------------------
  6.  
  7. Implicit None
  8. integer, parameter :: dp=selected_real_kind(15)
  9. real(dp) :: InitialPop, Birth, Death, Time
  10. integer :: FinalPop
  11. character (10) :: period
  12.  
  13. write (*,*) "Hello, I will figure out the population at a given point in the future given current information."
  14. write (*,*) "First of all, will this be in years, months, or days? Please enter year, month, or day."
  15. read (*,*) period
  16. write (*,*) "Please enter the current population."
  17. read (*,*) InitialPop
  18. write (*,*) "Please enter the current birth rate."
  19. read (*,*) Birth
  20. write (*,*) "Please enter the current death rate."
  21. read (*,*) Death
  22. write (*,*) "Alright, now enter how many ", period, "(s) over which you'd like to calculate."
  23. read (*,*) Time
  24.  
  25. Finalpop = InitialPop*exp((birth-death)*time)
  26.  
  27. write (*,*) "After ", time, period, "s there will be ", finalpop, "individuals."
  28.  
  29. stop
  30. end program populationgrowth
Success #stdin #stdout 0.01s 2624KB
stdin
year
100
0.4
0.2
15
stdout
 Hello, I will figure out the population at a given point in the future given current information.
 First of all, will this be in years, months, or days? Please enter year, month, or day.
 Please enter the current population.
 Please enter the current birth rate.
 Please enter the current death rate.
 Alright, now enter how many year      (s) over which you'd like to calculate.
 After    15.000000000000000      year      s there will be         2008 individuals.