Question: Programming Exercise 3: Non-recursive Fibonacci (10 points The Fibonacci sequence is l, l, 2, 3, 5, 8, 13, 21, 34, 55, he first term is


Programming Exercise 3: Non-recursive Fibonacci (10 points The Fibonacci sequence is l, l, 2, 3, 5, 8, 13, 21, 34, 55, he first term is 1. The second term is 1. Each term thereafter is the sum of the previous two terms) Write a C program that contains a function called fibonacci. This function, when given an integer tha strategy. The main function should provide the user with a menu of two choices: 1- Calculate Fibonacci 2- Exit (Enter 1 or 2) If the user enters a choice different from 1 or 2, your program should detect the invalid choice, and re-prompt the user to enter a new valid choice. If the user picks choice 1, your program should prompt him her to enter an integer number greater than 0. This number is first validated by the program, then function Fibonacci is called, and the result is displayed to the user The menu is continually displayed until choice 2 is entered by the user. Use a switch statement for controlling the menu. Here is an example of execution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
