Due Thursday, March 31, 11:59 P.M.
The purpose of this lab is to introduce you to functions and recursion in Fortran.
Write a Fortran program called fib that reads in an integer n from standard input, and then prints out the nth Fibonacci number on standard output, caclulated two different ways:
Recall that the Fibonacci numbers fn are given by the formula:
Note that you do not need to worry about timing your code. However, if you want to try this, you can use the intrinsic subroutine SYSTEM_CLOCK as follows:
INTEGER :: time, timerate, timemax ... CALL SYSTEM_CLOCK(time, timerate, timemax)This will store the current number of clock ticks in the variable time, the number of ticks per second in timerate, and the number of ticks before the clock rolls over in timemax. You can use this to determine how long each of your functions takes to complete.