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

  What will the glass temperature be for air velocities

Compare the effect of forced convection on heat transfer from an incandescent lamp with that of natural convection. What will the glass temperature be for air velocities of 0.5, 1, 2, and 4 m/s?

  Write an app that uses a foreach statement to sum the values

Write an app that uses a foreach statement to sum the values passed by the command line argument. Hint: Use static method ToDouble of class Convert to covert a string to a double value.

  Determine if the given subset is a subspace

Determine if the given subset is a subspace of the given vector space. Prove your claim - Is the set P of all polynomials of the form p(x) = a+x2, with a ? R, a subspace of P2?

  Write an algorithm to determine if a string is a palindrome

write an algorithm to determine if a string is a palindrome. Assume that the string is read from standard input one character at a time. The algorithm should output true or false as appropriate.

  The shift of american health insurance policiesnbsphow the

the shift of american health insurance policiesnbsphow the changes affect our economynbspi.nbsp a brief explanation of

  How write program stores two integers and allows user enter

How do you write a program that stores two integers and allows the user to enter a character. If the character is A, add the two integers

  Is the energy delivered to the device or taken from device

Suppose that the terminals of an electrical device are labeled a and b. If vab=-15V, how much energy is exchanged when a positive charge of 4C moves through the device from a to b? Is the energy delivered to the device or taken from device?

  Analyze the overall attributes of symmetric and asymmetric

"Cryptography"  Please respond to the following: Analyze the overall attributes of symmetric and asymmetric cryptography technologies. Discuss the advantages and disadvantages of each, and speculate upon the main reasons why organizations utilize bot..

  Describe the output following series of stack operations

Describe the output of the following series of stack operations: push(5),push(3), push(2), push(8), pop(), top(), push(9), push(1), pop(), push(7),push(6), top(), pop(), push(4), pop()

  Animation in the alice development environment

Create an original animation in the Alice development environment, using what you have learned about objects, methods, parameters, decision structures, repetition structures, and functions.

  Write a program that uses the xml file from par

Write a program that uses the XML file from par (a) to display the names, states, and party affiliation of all the senators in the DataGridView in order by state. The two senators from each state should be in order by their first names.

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