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
Jeremy is working with a team that is creating an application using attributes and associated methods. What type of programming
Ugo [173]
<span>object-oriented programming languages</span>
8 0
2 years ago
What type of backlighting receives dc power directly from a motherboard and doesn't use an inverter?
LenaWriter [7]
The answwer to the type of hardware is led lighting it does not need a inverter
3 0
3 years ago
Play station account
Reika [66]
I have a PlayStation as well
4 0
2 years ago
Read 2 more answers
What is printed when the following code has been executed?
serg [7]
Hey it is 15 hope this helps
3 0
3 years ago
1. What is the central idea of the section "Service Record." Use two text details to
Vladimir [108]

Answer:

Service record is the record that is used to track the record of service of the employ in an organization.

Explanation:

The idea behind the service record is to maintain the whole detail of record of the person during his employment including, personnel information,  record related to his promotions and posting, salary record etc.

8 0
3 years ago
Other questions:
  • Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with a
    13·1 answer
  • What will happen if you change data that is used in a formula
    10·1 answer
  • Can your computer become infected with a virus via email
    10·1 answer
  • "what should you do if the system continually reboots and you can't read the error message produced on a blue screen
    11·2 answers
  • BOTH INTERNATIONAL &amp; INLAND Which procedure(s) shall be used to determine risk of collision?
    14·1 answer
  • Programming assignment (100 pts): In the C++ programming language write a program capable of playing Tic-Tac-Toe against the use
    14·1 answer
  • Which agency coordinate the Internet's IP addressing and DNS system.
    15·1 answer
  • Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga
    12·2 answers
  • Remember partially filled arrays where the number of elements stored in the array can be less than its capacity (the maximum num
    14·1 answer
  • Write a program to prompt the user for hours worked to compute a gross pay for an employee, and he is paid 100/hour. If he worke
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!