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 1

								c       This program will not compile. The one-line "if" statement
c       is not supposed to contain "then". To fix it, delete "then".
        program positive
        real x
        print *, "What is your number ?"
        read *, x
        if (x .gt. 0) then print *, "Your number is positive."
        print *, "Bye"
        end