Fortran: Lesson 3

Lesson topics


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

Demo 3

								        program demo3
c       With integer variables, Fortran throws away the decimal point
c       and all digits thereafter. Run the program and see what
c       happens to m and n, as compared with x and y.
        integer m, n
        real x, y
        m = 4.5
        x = 4.5
        n = sqrt(5.)
        y = sqrt(5.)
        print *, "m = ", m
        print *, "x = ", x
        print *, "n = ", n
        print *, "y = ", y
        end