Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions