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 7

								        program demo7

c       This program prints "aloha", then 2 spaces, then "poi",
c       then sqrt(2) to 3 decimal places beginning in column 30,
c       then a line feed, then sqrt(2) to 15 decimal places 
c       beginning in column 20, then 3 spaces, then the integer 2001.

        double precision x
        integer n
        x = sqrt(2D0)
        n = 2001

        write (*,5) "aloha", "poi", x, x, n
 5      format (a,2x,a,t30,f5.3,/,t20,f18.15,3x,i4)
        end