C Copyright (c) 2010 the authors listed at the following URL, and/or C the authors of referenced articles or incorporated external code: C http://en.literateprograms.org/Fibonacci_numbers_(FORTRAN)?action=history&offset=20090816134056 C C Permission is hereby granted, free of charge, to any person obtaining C a copy of this software and associated documentation files (the C "Software"), to deal in the Software without restriction, including C without limitation the rights to use, copy, modify, merge, publish, C distribute, sublicense, and/or sell copies of the Software, and to C permit persons to whom the Software is furnished to do so, subject to C the following conditions: C C The above copyright notice and this permission notice shall be C included in all copies or substantial portions of the Software. C C THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, C EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF C MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. C IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY C CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, C TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE C SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. C C Retrieved from: http://en.literateprograms.org/Fibonacci_numbers_(FORTRAN)?oldid=16495 program main implicit none interface function fib(n) integer, intent(in) :: n integer :: fib end function fib end interface print *, fib(10) end program main recursive function fib (n) result (fnum) integer, intent(in) :: n integer :: fnum if (n<2) then fnum = n else fnum = fib(n-1) + fib(n-2) endif end function fib