Lesson topics
Demo 1
program annulus
c This program calculates the area of an annulus.
c The inner and outer radii are input by the user.
c A statement function for the area of a circle is used.
double precision r, area, pi, a, b
parameter (pi = 3.1415926535897932D0)
area(r) = pi * r * r
print *, "Enter the inner and outer radii of the annulus:"
read *, a, b
write (*,10) "Area of the annulus: ", area(b) - area(a)
10 format (a,f25.15)
end