next up previous
Next: Do-Loop Up: Sample Programs Previous: Types

If-then-Else

       Program TryIf
       write(*,100)
       Read(*,*) X
       If (X .LT. 0) Then
          write(*,*) X, 'is a negative number'
       elseif (X .GT. 0) Then
          write(*,*) X, 'is a positive number'
       else
          write(*,*) 'X is 0'
       endif
  100  format('Please input a number: ',$)
       end



Russ Miller
Thu Sep 14 13:56:19 EDT 1995