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
What is cpu?<br>please give me right answer ​
LUCKY_DIMON [66]

Answer:

Explanation:

processor such as intel/amd processors

7 0
2 years ago
Read 2 more answers
What are the two ways to use the help menu
neonofarm [45]
What help menu are you talking about?
6 0
3 years ago
Read 2 more answers
Enumerate the the risk in the preparation and cooking in starch and cereal dishes and other food​
Novay_Z [31]
———————————————————.
6 0
3 years ago
A college team's BCS football ranking is comprised of three elements:1) the Harris Poll score, 2) the Coaches Poll score, and 3)
artcher [175]

Answer:

harris_poll_ranking = int(input("Enter team's Harris Poll ranking [1 - 2,850]: "))

coaches_poll_ranking = int(input("Enter team's Coaches Poll ranking [1 - 1,475]: "))

computer_ranking  = float(input("Enter team's computer ranking  [0 - 1]: "))

harris_poll_score = harris_poll_ranking / 2850

coaches_poll_score = coaches_poll_ranking / 1475

bcs_score = harris_poll_score / 3 + coaches_poll_score / 3 + computer_ranking / 3

print(bcs_score)

Explanation:

*The code is in Python.

Ask the user to enter the  harris_poll_ranking as int, coaches_poll_ranking as int and computer_ranking as float

Calculate the harris_poll_score, divide the harris_poll_ranking by 2850

Calculate the coaches_poll_score, divide the coaches_poll_ranking by 1475

Calculate the bcs_score, harris_poll_score, coaches_poll_score and computer_ranking by 3 and sum them

Print the bcs_score

6 0
3 years ago
HURRY PLEASE ITS A TEST
laiz [17]

<em>A.)</em>

<em>It's either A or D both of them stand out and make sense to me so I think that it'll be right if you choose A or D.</em>

<em>-Ɽ3₮Ɽ0 Ⱬ3Ɽ0</em>

8 0
3 years ago
Other questions:
  • Fill in the blank - A generation of social-oriented, physical games such as the _______ Wii console, emerged in the late 2000s,
    15·1 answer
  • ________ are used in input, processing, and output operations that can help create more efficient programs as the data can be pr
    11·1 answer
  • One item you will NOT need to provide when opening up a bank account
    9·2 answers
  • Give an example of an outdated memory or storage device what do you think they are outdated
    12·1 answer
  • g If a class named Student has a data member named gpa , and one of its member functions has a parameter also named gpa , how ca
    7·1 answer
  • The area surrounding your car that can't be seen from the driver's seat is called
    14·2 answers
  • By the 1990s, ______________ technology enabled one person operating a desktop computer to control most—or even all—of these fun
    8·2 answers
  • Exercise 3.6.9: 24 vs. "24"5 points
    7·1 answer
  • Write a function template that accepts an argument and returns its absolute value. The absolute value of a number is its value w
    11·1 answer
  • The main part of your program has the following line of code.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!