next up previous
Next: Better Idea Up: CS101 Lecture 10 Previous: Functions

Example Problem

Suppose when solving some problem, we need 3 inputs from the user.
  1. Temperature (valid value is between 1 and 100)
  2. Pressure (valid value is between 501 and 600)
  3. Volume (valid value is between 801 and 900)
How do we do this in the program? Is the foll. good?
  Read (*,*) Temp
  If ((Temp < 1) .OR. (Temp > 100)) Then
     Write (*,*) 'Sorry wrong value for Temperature'
     Stop       ! the program terminates here!!
  End If
  ! similar code for pressure
  ! similar code for volume



G. Sivakumar 2000-08-23