This preview shows page 1. Sign up to view the full content.
Unformatted text preview: integer :: Num, J integer, dimension(100) :: Fibb Write(*,*)'Input number for which you would like to calculate the Fibonacci number: ' read(*,*) Num Fibb(1) = 1 Fibb(2) = 1 if (Num > 46 ) then write(*,*)'Cannot calculate this Fibonacci number.' stop elseif (Num < 0) then write(*,*)'Cannot calculate this Fibonacci number.' stop else Write(*,*)'1 :', Fibb(1) Write(*,*)'2 :', Fibb(2) do J = 3, Num, 1 Fibb(J) = Fibb(J - 1) + Fibb(J - 2) write(*,*) J,':', Fibb(J) end do end if stop end...
View Full Document
This note was uploaded on 10/05/2009 for the course ENGR 117 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.
- Spring '08
- Computer Programming