Skip to main content

9.5) Exercise 6: Solution


The following is one of many possible solutions.

There are numerous ways to add two more intrinsic functions. For example, between lines 6 and 7 you could add the following statements:

y=log(y)+cos(x)

The full code is shown below:

       program example15
       integer :: i, j     ! use a comma to declare more variables.
       x=3.14159
       x=x*0.1
       y=2*sin(x)+10.0
       y=sqrt(y)
       y=log(y)+cos(x)
       print *, ‘The result is ‘,y
       end program example15