Question: Example of input and outputs: Write a program in C that: Asks the user to enter an integer n that is at least2. If the

 Example of input and outputs: Write a program in C that:

Example of input and outputs:

Asks the user to enter an integer n that is at least2.

If the user enters an integer that does not satisfy this condition,

Write a program in C that: Asks the user to enter an integer n that is at least2. If the user enters an integer that does not satisfy this condition, the program prompts the user again, until an integer n>2 is entered. The program then initializes two long long variables fibIM2 to 0 and fibIM1 to 1 respectively. The program then uses a loop on i, from 2 to n (both included), to compute fn, by computing fibi out of fibIM1 and fibIM1and updating these two latter variables. At each loop turn, the program also computes the ratio fi-1 on a double variable for all values of i, starting at 2. Caution: a cast is needed to get areal-valued ratio. When the loop is finished, the program prints out fn as well as the ratio in. Please enter an integer that is at least 2: 7 fib(7) = 13, fib(7) / fib(6) = 1.625000. Please enter an integer that is at least 2: 42 fib(42) 267914296, fib(42) / fib(41) = 1.618034. Please enter an integer that is at least 2: 1 Sorry. Your input is incorrect. Please try again. Please enter an integer that is at least 2: 0 Sorry. Your input is incorrect. Please try again. Please enter an integer that is at least 2: -1 Sorry. Your input is incorrect. Please try again. Please enter an integer that is at least 2: 2 fib(2) = 1, fib (2) / fib(1) 1.000000

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!