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
sp2606 [1]
3 years ago
12

1- By using C++ programming language write a program which displays the Fibonacci Series numbers. Note: The number of elements i

s taken as in input from the user Hint: The Fibonacci Sequence: 0,1,1,2,3,5,8,13,21,34,55.. .
Computers and Technology
1 answer:
dedylja [7]3 years ago
3 0

Answer:

i hope this helpful for you

Explanation:

Example 1.

#include <iostream>

using namespace std;

int main() {

   int n, t1 = 0, t2 = 1, nextTerm = 0;

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

   cin >> n;

   cout << "Fibonacci Series: ";

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

       // Prints the first two terms.

       if(i == 1) {

           cout << t1 << ", ";

           continue;

       }

       if(i == 2) {

           cout << t2 << ", ";

           continue;

       }

       nextTerm = t1 + t2;

       t1 = t2;

       t2 = nextTerm;

       

       cout << nextTerm << ", ";

   }

   return 0;

}

Example 2.

#include <iostream>

using namespace std;

int main() {

   int t1 = 0, t2 = 1, nextTerm = 0, n;

   cout << "Enter a positive number: ";

   cin >> n;

   // displays the first two terms which is always 0 and 1

   cout << "Fibonacci Series: " << t1 << ", " << t2 << ", ";

   nextTerm = t1 + t2;

   while(nextTerm <= n) {

       cout << nextTerm << ", ";

       t1 = t2;

       t2 = nextTerm;

       nextTerm = t1 + t2;

   }

   return 0;

}

You might be interested in
Suppose that you created an robot that was so advanced it could act independently in very complex situations. It made its own de
Mashutka [201]
It should not be capable of free action because there's no telling if it would be friendly for good remarks or mean for rude remarks
8 0
4 years ago
In what type of attack does the adversary leverage a position on a guest operating system to gain access to hardware resources a
il63 [147K]

Answer:

VM escape attack

Explanation:

<em>In a VM escape attack, the attacker exploits hypervisor vulnerabilities to gain control over resources reserved for other guest operating systems. Services operating on the guest may be exposed to the other attacks, but such attacks can only access data allotted to the same guest. In the event of a buffer overflow or directory traversal or the client in the case of cross-site scripting.</em>

6 0
2 years ago
Your mobile device has gone over its subscribed data limit the past two months. During this time, you have noticed that the devi
Zolol [24]

Answer:D. The device needs an operating system update

Explanation:Operating systems are different programs mainly manufactured by software companies like Microsof,Apple etc, after initially installation are loaded into the computer by a boot program, operating systems manages all of the other application programs in a computer, it requires constant upgrade in order to be able to effectively carry out its activities. Application programs uses the operating system by making requests for services through a defined application program interface (API). Examples include Windows 7, Windows 8, Windows 10, Blackberry OS, Operating system Linux etc.

6 0
3 years ago
Given the variables costOfBusRental and maxBusRiders of type int , write an expression corresponding to the cost per rider (assu
Liono4ka [1.6K]

Answer:

       int costOfBusRental;

       int maxBusRiders;

       int costPerRider;

       costPerRider = costOfBusRental/maxBusRiders;

Explanation:

The costPerRider is the total cost of renting the bus (costofBusRental) divided by all the bus users (maxBusRiders). So we declare the three variables to be of type int as required by the question.

7 0
4 years ago
What is the Is option that prints the author of a file​
sleet_krkn [62]

Answer:

Print.. is your answer...

4 0
3 years ago
Other questions:
  • An organization that operates a small web-based photo backup business is evaluating single points of failure. The organization h
    7·1 answer
  • Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
    9·1 answer
  • Can you answer your own question on brainly?
    12·2 answers
  • Where does the Total row of an aggregate function display its results? First row in Datasheet view Only row in Datasheet view La
    10·1 answer
  • One of the prominent movies released in the 1950s is
    15·2 answers
  • How does the actual amount left to spend differ from the budgeted amount for the remaining three months of the project?
    12·1 answer
  • Can you get in trouble for copying something you thought you were allowed too reddit?
    9·1 answer
  • Have you heard about Gold Opinions?<br><br> It is a new product that just came out.
    6·1 answer
  • Trong mạng internet, chúng tôi thay đổi công nghệ mạng LAN sang một công nghệ
    5·1 answer
  • What is a table in Excel?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!