Fibonacci sequence in Fortran (1 Viewer)

PaterzAttack

fake based bitch
Joined
Aug 16, 2009
Messages
978
Gender
Male
HSC
2011
Hello
Is this the appropriate forum to post this?


Currently learning Fortran in one of my courses and this was one of the questions in a tutorial:

In the Fibonacci sequence of numbers, each number is the sum of the previous two numbers, starting with 0 and 1. For instance the first 10 numbers in the sequence include 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.
Write a Fortran 90 program that reads an integer number N from keyboard and then writes the first N numbers of the Fibonacci sequence on the screen. Test your program for N=5,10 and 20.


Initially I had trouble understanding DO Loops, and there are still some things I'm a little fuzzy on.
My main problem is trying to figure out how to represent the Fibonacci sequence in Fortran coding.
Any help would be appreciated.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top