Introduction to Fortran

Simple Program Construction in Fortran » Making Decisions » Coding Your Own Decisions

Question 1 of 1

Based on the following pseudocode, type into the code in the box to add any one of the decision points for tops or bottoms.

 if today is a weekend      if the forecast temperature is at or above 70˚F...      if the forecast temperature is above 60˚F...  else (today is a workday)      if the forecast temperature is at or above 70˚F...      if the forecast temperature is above 60˚F...  

All four if-else statements are written in the code below. You only had to write one of them, but they all follow the same general structure. Aside from starting on the 7th column for executable information, the indentation in our code doesn’t matter. We have indented further to help readability of nested statements. We are currently using 5 further spaces inward for indentation of nested code. The number of spaces is up to you.

 program pick_outfit implicit none  integer high_temp logical weekend  high_temp = 64 weekend = .TRUE.  if (weekend .EQ. .TRUE.) then      if (high_temp .GE. 70) then      else      end if      if (high_temp .GE. 60) then      else      end if else      if (high_temp .GE. 70) then      else      end if      if (high_temp .GE. 60) then      else      end if end if  end