Question: Write a program that will read in two values. These two values will be used to generate a Fibonacci sequence. A Fibonacci sequence starts with

Write a program that will read in two values. These two values will be used to generate a Fibonacci sequence. A Fibonacci sequence starts with 2 numbers. The third number in the list is the sum of the first two numbers. The fourth number in the list is the sum of the second and third numbers, and so on. For example, if you start with 0 and 1 the sequence would be: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.

The first two numbers of the sequence must obey a set of rules. The rules that you must verify are: The first number is greater than or equal to zero. The second number is greater than or equal to one. The second number is greater than or equal to the first number. If any of the rules are broken, print out an error message telling the user what the problem is and DO NOT calculate the sequence.

If the first two Fibonacci values are valid then prompt the user for a third value that will ask for the number of values in your sequence. So if the user enters 10, you will print the two values that were entered and 8 newly calculated values.

C programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!