Write a function called fibonacci

Assignment Help C/C++ Programming
Reference no: EM131137846

By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two;

for example, the first 6 Fibonacci numbers are 0, 1, 1, 2, 3, 5.

Write a program that asks the user for a number between 5 and 11 (inclusive) and then displays that many Fibonacci numbers.

YOU MUST write a function called fibonacci which is called from main as follows:

if ((num < 5) || (num > 11)) cout "Please follow the directions!" endl; else { total = fibonacci(num); cout << endl; cout << "Total is "; cout << total; cout << endl; }

Note that the function adds up each of the Fibonacci numbers and returns the total to main.

Reference no: EM131137846

Questions Cloud

How do you perceive employment conditions : how do you perceive employment conditions?  - Does it seem like we'll have more structural problems in the future?
At what interest rate would this become attractive : Your company is looking at the possibility of replacing this loan with a loan that has estimated closing costs of $3,300.00. At what interest rate would this become attractive?
Determine the quantity of sand required : The sand in its loosest state has a porosity of 90% and the desired porosity, when compacted, is 20%. Assuming the average thickness of the completed island is 100 m, determine the quantity of sand required.
At what interest rate would this become attractive : Your company is looking at the possibility of replacing this loan with a loan that has estimated closing costs of $3,300.00. At what interest rate would this become attractive?
Write a function called fibonacci : By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two;
A random sample of size n from a normal population : Given a random sample of size n from a normal population with μ = 0, use the Ney man-Pearson lemma to construct the most powerful critical region of size α to test the null hypothesis σ = σ0 against the alternative σ = σ1 > σ0.
The manufacturer of the new medication feels : Suppose that in Example 1 the manufacturer of the new medication feels that the odds are 4 to 1 that with this medication the recovery rate from the disease is 0.90 rather than 0.60. With these odds, what are the probabilities that he will make a..
If price of a good is set higher than equilibrium price is : If the price of a good is set higher than the equilibrium price: - Suppose that quantity supplied of a product equals 5 and quantity demanded equals 8. In this market, there is a:
The critical region of the likelihood ratio test : The number of successes in n trials is to be used to test the null hypothesis that the parameter θ of a binomial population equals 1/2 against the alternative that it does not equal 1/2.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Demonstrates steps to analyze the problem

Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input

  Program that allows the user to enter the last names

The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate.

  rewrite that statement in a more readable style.

Give an example statement in C, C++, or Java that is particularly unreadable. Rewrite that statement in a more readable style.

  Write a function named flattens

Write a function named flattens that takes a two-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array's elements.

  Two types of sporting teams

Select two types of sporting teams and de?ne subclasses for them. These classes shouldinherit from a base team class such as that created in Exercise 1. Include uniquecharacteristics about the sport.

  Write program to determine a car acceleration

Write C++ program to determine a car's acceleration written in 10 seconds

  Write a program that will indicate two straight lines

Write a program that will indicate whether two straight lines intersect. Each line is specified by giving two points (xi, yi) that are on the line

  Define and implement a default constructor for robot class

Define and implement a default constructor for the Robot class that sets the locations to zero, and load to false (no load is being carried by the Robot)

  How can it has a output

I wonder what is the field "out" use for? Instructors comment it "// stream where Target will prints its output". Target is not a function, how can it has a output? I also confused about "std::ostream &out = std::cout", don't understand what is it..

  How many different copies of the variable c are there

Most round-robin schedulers use a fixed size quantum. Give an argument in favor of and against a small quantum.

  Create a permutation generator script for us

create a permutation generator script for us that will generate all the permutations possible from a set of words. The script can be written in PHP, jscript, Python or Java.

  Design and implement a class called cheetah

Create a method that calculates the time required to travel between the starting point and stopping point of the line based on a given speed.

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