10.5) Exercise 7: Solution
The following solution makes use of the last two examples.
program example18 real :: x,y,z x=5.0 ; y=10.0 call mysb(x,y) z=myfn(x,y) print *, z*z contains function myfn(x,y) real :: x,y,s,myfn s=(x**2+y**2) myfn=sqrt(s) end function myfn subroutine mysb(x, y) real :: x, y, z z=0.45 x = z + y**2 end subroutine mysb end program example18
subroutine
and a function
.