1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Serga [27]
3 years ago
9

Write an application program in C++ to implement a class Fibonacci to print Fibonacci series upto N using member function series

() .
​

Computers and Technology
1 answer:
fiasKO [112]3 years ago
5 0

Answer:

Program approach:-

  • Using the header file.
  • Using the standard namespace I/O.
  • Define the main function.
  • Display the number of terms.
  • Display the Fibonacci series.
  • Print the first two numbers.

Explanation:

Program:-

//header file

#include <iostream>

//using namespace

using namespace std;

//main function

int main() {

   int n, s1 = 0, s2 = 1, nextTerm = 0;

//display the number of terms

   cout << "Enter the number of terms: ";

   cin >> n;

//display the Fibonacci series

   cout << "Fibonacci Series: ";

   for (int j = 1; j <= n; ++j) {

       // Prints the first two terms.

       if(j == 1) {

           cout << s1 << ", ";

           continue;

       }

       if(j == 2) {

           cout << s2 << ", ";

           continue;

       }

       nextTerm = s1 + s2;

       s1 = s2;

       s2 = nextTerm;

       

       cout << nextTerm << ", ";

   }

You might be interested in
Some file formats are specific to the program that uses them and the operating system on which they are used. True or False
mina [271]

Answer:

true

Explanation:

certain file formats can only be used to it's own operating system

5 0
4 years ago
Read 2 more answers
The high-latitude climate is _____________ the equator.<br><br> closest to<br> farthest from
BARSIC [14]
I believe it’s farthest from
5 0
3 years ago
Create a spreadsheet that lists the ten currencies you chose. For each currency, enter an amount and create a
Softa [21]

Answer:

its a very lengthy one

Explanation:

4 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Molodets [167]

Answer:

Increase/decrease indent

Explanation:

8 0
2 years ago
16. When the speed limit is not posted, the default
Elanso [62]

Answer:

C. 55, 30

Explanation:

Even though each state in the United States has different speed limits. However, in a situation whereby the speed limit is not posted, the default speed limit recommends that drivers maintain a speed of "55" mph on the highway and "30" mph in the city.

The highest speed limit in the United States is 85mph on a rural highway in Texas while the lowest generally for the country is 30mph in a residential area.

3 0
3 years ago
Other questions:
  • Why does a HTML seen to work even when its broken? why does the code sometimes turn pink?
    9·1 answer
  • Can someone help me
    8·1 answer
  • Does anyone know? If you do please answer.
    9·1 answer
  • When you check the spelling in a document, one of the options is to add unrecognized words to the dictionary. If you were workin
    8·1 answer
  • A software team is setting an automation strategy and begins by identifying business processes that could benefit from automatio
    12·1 answer
  • Analyze the map below and answer the question that follows. A topographic map of Northwestern Russia. Areas on the map are circl
    13·2 answers
  • # input a mark in a subject of a student and
    9·1 answer
  • Consider the following code segment, where num is an integer variable.int[][] arr = {{11, 13, 14 ,15},{12, 18, 17, 26},{13, 21,
    8·1 answer
  • yo guys go sub to my channel road to i guess 20 or 30 my yt channel is called The Golden StreamerYT i have 16 subs we are almost
    10·2 answers
  • Why the computer is known as versatile and diligent device ? explain.<br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!