Non-recursive fibonacci

Assignment Help Basic Computer Science
Reference no: EM131291626

Non-recursive Fibonacci

The Fibonacci sequence is 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...

(The 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 n >= 1, will return the nth Fibonacci number. The function should use a non-recursive,iterative 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, than 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.

Reference no: EM131291626

Questions Cloud

Field of modern security : Write a 700- to 1,050-word paper in which you compare how technology has affected the field of modern security over the last 20 years.
How you feel that ethics will impact on your it career : How you feel that ethics will impact on your IT career. Write also the ethicaltheory which can be the best to guide your behaviors. Also, including the goals and situations that you may face.
Labsim testout security pro : Please log into LabSim TestOut Security Pro and complete all labs and end of chapter exams in Chapter 7. There is NO TIME LIMIT to complete these labs and you may try them more than once.
Applying skills learned : From the e-Activity, explain what you learned about the Website you selected by looking at the source code. (i.e., the version of HTML that was used, comment tags, if the head elements were marked, and if so, the type of information they contained..
Non-recursive fibonacci : Write a C program that contains a function called fibonacci. This function, when given an integer n >= 1, will return the nth Fibonacci number. The function should use a non-recursive,iterative strategy. The main function should provide the user w..
How will you transfer these new skills : How will you transfer these new skills and the information gained to your workplace?What methods did you find to better understand the Coding Guidelines that you identified as difficult or challenging in this week's discussion?
Explanation on visual logic with the question : Design a class named Automobile that holds the vehicle identification number, make, model, and color of an automobile. Include methods to set the values for each data field, and include a method that displays all the values for each field. Create ..
Identify at least 5 issues to be addressed by management : After reading the attached "canadian Solar" case, Identify at least 5 issues to be addressed by management and to do a one-page summary of the issues for given case.
Discuss the concept of selection in terms : Discuss the concept of selection in terms of what we perceive. Try to think of examples of how you have engaged in selective exposure, selective perception and or selective memory. How has this perhaps skewed your views of the world?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd