Assignment #2 - 94B

Assignment #2 - 94B

    Assignment 2

  Due 29 September 1994
  Weight 20
  E-Mail to   HCA2         <<== Mail sent anywhere else will be IGNORED
  T.A. Lucie Bernier Room 322

  Fibonacci like Series:

   In this assignment you will have to test series of four numbers
  to verify that they follow the pattern of Fibonacci series: i.e. given the
  the first two numbers in the serie, the next one is the sum of the    vious
  two previous numbers and so on.
  For example if the two first numbers are 0 and 1,
  then the third number is 1, then 2, then 3 and then 5, 8, 13....

   You will be reading in 4 numbers at a time, testing the third
  and forth one to check if they follow the serie's property. If they doo,
  you should output the first 4 numbers together with the next two      rs
  numbers that would continue that particular serie.  If either the     th
  third or the forth number is incorrect, you should indicate which
  number was found wrong and output, still, the 6 numbers of the serie.
  As soon as a number is found to be wrong, you can stop checking and   l
  just go on and compute the rest of the serie.

    You also have to keep track of how many series of numbers you
  treated and print out the total series treated at the end of your
  output.  Data to be used is provided below.

   Your FORTRAN program should be able to process as many lines of
  data as the user provides.   Your output may look like this:

  Series 1 :  2  5  7  12  19  31
  Series 2 :  Fourth number - 2 - was wrong.
              -2  3  1  4    5  9

  Number of series treated : 2.

  Stop your program by testing for an "empty" data line such as:

   0  0  0  0

  As an alternative you could use a READ Statement, like this one:

        READ(5,*,END=99) num1, num2, num3, num4

  which will transfer to statement 99 when the *End of File is found.

  See that you DOCUMENT your program clearly, and identify the
  different sections:
    Calculation/Treatment of data
    End of Data processing - print a count of the number of series

  Your program should put out a title to identify what it does.   Output
  data should be neatly lined up, as shown in the example.

  Here is the data to use - feel free to add  extra series if you want

   1  4  5  9
  -3 -5 -8  13
   0 -5 14  -9
   0  1  1  2
   1.5  3.3  4.8  8.1
   0.9  -0.1 1.2  1.1