WARNING: This example assumes the output is sent to a printer, and as a result, every formatted output contains printer control.
1 1 2 2 3 3 4 4
....5....0....5....0....5....0....5....0....5
1 1 1 1.0000000 1.0000000
2 4 8 1.4142135 1.1892071
3 9 27 1.7320508 1.3160740
:
:
:
10 100 1000 3.1622777 1.7782794
PROGRAM Squares_and_Roots
IMPLICIT NONE
INTEGER, PARAMETER :: MAXIMUM = 10
INTEGER :: i
CHARACTER(LEN=30) :: Format
Format = "(3I6, 2F12.7)"
DO i = 1, MAXIMUM
WRITE(*,Format) i, i*i, i*i*i, SQRT(REAL(i)), SQRT(SQRT(REAL(i)))
END DO
END PROGRAM Squares_and_Roots
Click here to download this program.
1 1 2 2 3 3 4 4
....5....0....5....0....5....0....5....0....5
1 1 1 1.0000000 1.0000000
2 4 8 1.4142135 1.1892071
3 9 27 1.7320508 1.3160740
4 16 64 2.0000000 1.4142135
5 25 125 2.2360680 1.4953488
6 36 216 2.4494898 1.5650846
7 49 343 2.6457512 1.6265765
8 64 512 2.8284271 1.6817929
9 81 729 3.0000000 1.7320508
10 100 1000 3.1622777 1.7782794
CHARACTER(LEN=30) :: Format Format = "(3I6, 2F12.7)"