Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Only follow the direction and use variable that i would understand please im kinda mew to this program Sample run 2. The Fibonacci sequence

C++
Only follow the direction and use variable that i would understand please im kinda mew to this program
image text in transcribed
Sample run
image text in transcribed
2. The Fibonacci sequence is 0,1,1,2,3,5,8,13,21, where the first two terms are 0 and 1 , and each term thereafter is the sum of the two preceding terms. Write a program that repeatedly prompts for and reads a positive integer value n and then calculates and displays the nth number in the Fibonacci sequence (the program should force reentry if the user enters a non-positive n ). For example, if n=8, then the program would display 13 . Program requirements: a) Use a do loop to ensure that the user enters a positive value for n. b) Use a for loop to perform the calculations needed to determine the nth Fibonacci number. c) Use a do loop to control the program repetition for finding more Fibonacci numbers. Following is a sample output from the program (user input is bold): Enter a positive integer n:3 Enter a positive integer n:0 Enter a positive integer n:8 8th Finbonacci number 13 Continue ( y or n) ? y Enter a positive integer n : 5 5 th Finbonacci number 3 Continue (y or n)?n Process exited after 37.34 seconds with return value 0 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

=+ (b) Show that X' and Y' are dependent but uncorrelated.

Answered: 1 week ago

Question

How do you add two harmonic motions having different frequencies?

Answered: 1 week ago

Question

Describe the appropriate use of supplementary parts of a letter.

Answered: 1 week ago