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

  Principles of information security

Assume you have converted an area of a general office space into a server room. Describe the factors you would consider for each of the following components.

  Identify and describe any potential ethical issues

Identify and describe any potential ethical issues that could arise in connection with the new architecture.

  Critical to the conduct and results of hrp

Why are decisions about job categories and levels so critical to the conduct and results of HRP? Within the process of human resource planning (HRP), what part do job categories and levels play? How do they affect the final results? How does th..

  Create alternative versions of compute freqs ()

Time () to determine if one approach is much faster or slower than the others

  Design an application to take and process a pizza order

Design an application to take and process a pizza order. The user should be able to make pizza order choices from listboxes, and the application should display the order price.

  Best practices for security in rdbms

"Can you do some research and tell us a little on best practices for security in RDBMS' in regard to transactions? What if a hacker takes money in a transaction sent to their account and then issue a ROLLBACK to the calling bank?"

  Write a program to simulate a deck of 52 playing cards

Write a program to simulate a deck of 52 playing cards. Represent your deck as a 2D Array where the value in the cell is the position of the card in the deck. Represent the names for the suits and faces as an array of Strings.

  The current environment

The current environment doesn't have wireless interface, and the management would like to procure a cutting edge wireless technology infrastructure for the organisation.

  Problem regarding the amount of a purchase

Design a program that will ask the user to enter the amount of a purchase. The program should then compute the state sales tax and the county sales tax. Assume the state sales tax is 4 percent of the purchase amount, the county sales tax is 2 perc..

  What the difference between unix and linux

What's the difference between Unix and Linux? What is better for a computer science graduate student in his independent project?

  List the sequence in which all constructors

list the sequence in which all constructors and destructors are called. Also, provide the explanation for why they are called in this sequence.

  Explaining laws dealing with computer crimes

Write and explain three recent laws dealing with computer crimes.

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