Sample File to Input, area.f
Next: Specific Unix Commands
Up: GETTING FRIENDLY WITH
Previous: Control-Key Commands
We give here is the listing for a program area.f
(it's Fortran but that doesn't matter). We suggest you enter this
program into a file called area.f on your computer, and then
use this file to try out the Unix tools and editors. It is small, you
can always get it back if it gets ruined, and you can even compile and
run it.
PROGRAM area
c area of circle, r input from terminal
DOUBLE PRECISION pi, r, A
c Best value of pi for IEEE floating point
pi = 3.14159265358979323846
c read r from standard input (terminal)
Write(*, *) 'specify radius, e.g. 1.0 '
Read (*, *) r
A = pi * r**2
c write area onto terminal screen
Write(*, 10) 'radius r =', r, ' A =', A
10 Format(a20, f10.5, a15, f12.7)
STOP 'area'
END
Next: Specific Unix Commands
Up: GETTING FRIENDLY WITH
Previous: Control-Key Commands