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 6

								c       This program has two "end" statements. It will not compile.
c	To fix it, change the first "end" to "stop".
        program root
        real x
        print *, "What is your number ?"
        read *, x
        if (x .lt. 0) then
                print *, "Your number has no square root. Bye."
                end
        end if
        print *, "The square root of your number is : ", sqrt(x)
        print *, "Bye"
        end