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
Which of the following operation is not performed by a mouse 1) left click , middle click , right click, double click​
agasfer [191]

Answer:

middle click

Explanation:

hope it helps

3 0
3 years ago
Read 2 more answers
What is one reason you might want to change your document's margins
Masteriza [31]

Answer:

1. If there is a big table or picture needed to show in a single paper.

2. For showing differences between two things.

3. To have more words to fit in a paper

Explanation:

6 0
3 years ago
A technician has verified that a video card to be added to a desktop machine will fit and so will a new sound card. What should
yaroslaw [1]

Answremove the old sound and video card

Explanation:

for them to be able to be installed you have to get rid of the one that your trying to replace

7 0
4 years ago
Choose the answer that best completes the statement.
Anestetic [448]
1. A - everything starts there
2. D - always
3. C - true
4 0
3 years ago
Read 2 more answers
Hot five was the famous band of which musician?
slega [8]
Hot Five was Louis Armstrong's first recording jazz band.
4 0
4 years ago
Other questions:
  • Store shelves are empty during periods of Excess Demand. What is another term for Excess Demand?
    8·1 answer
  • Write a Python program that creates a dictionary containing course numbers and the room numbers of the rooms where the course me
    7·1 answer
  • GDP measures the production levels of any nation. This implies a correlation between production levels and ____________.
    8·1 answer
  • Which type of graph or chart measures
    15·2 answers
  • A manger wants to hire a new technician for the desk that typically assists clients with simple computer problems over the phone
    9·1 answer
  • A museum is evaluating historical documents for authenticity, reviewing their physical condition, and categorizing them by subje
    9·1 answer
  • The following procedure is intended to return the number of times the value val appears in the list nylist. The procedure does n
    15·2 answers
  • Plsssssssss help me​
    8·1 answer
  • someone please do this for and send a screeshot or picture please its really important for my examsss :D​
    9·1 answer
  • The four main disabilities or impairments that computers can modify are for
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!