Fortran: Lesson 2

Lesson topics


View Demos
# 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10
Download Demos
# 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10

Demo 7

								c       This program demonstrates use of ".and." and ".or."
        program demo
        integer age
        print *, "What is your age ?"
        read *, age
        if (age .ge. 18 .and. age .le. 64) then              
                print *, "You can vote but you cannot retire."
        end if
        if (age .le. 12 .or. age .ge. 20) then
                print *, "You are not a teenager."
        else
                print *, "You are a teenager."
        end if
        print *, "Bye"
        end