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
zhuklara [117]
3 years ago
13

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te

rms will be:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

a term index is entered and Fibonacci sequence is calculated up to that term.

If the index is 5 then the sequence is : 0, 1, 1, 2, 3

if the index is 7 then the sequence is : 0, 1, 1, 2, 3, 5, 8

Write a program that will print the Fibonacci sequence to the term index entered by the user.

The program will ask you if you want to print another sequence; if Yes repeat if No end your program
Computers and Technology
1 answer:
AlexFokin [52]3 years ago
3 0

//C++:

#include <iostream>

#include <string.h>

using namespace std;

int F(int n) {

 if(n == 0) {

   return 0;

 }

 if(n == 1) {

   return 1;

 }

 else  

   return F(n-1) + F(n-2);

 }

int main()

{

   int index;

   int ok=0;

   char x[3];

   do{

   cout<<"index=";cin>>index;

   for(int i=0;i<index;i++)

   cout<<F(i)<<' ';

   cout<<endl;

   cout<<"Repeat? (Yes/No):";

   cin>>x;

   if(strcmp(x,"No")==0)

   ok=1;

   cout<<endl;

   }while(ok==0);

   return 0;

}

You might be interested in
When was internet created in which year​
fiasKO [112]

Answer:

it was invented in 1983

3 0
3 years ago
Read 2 more answers
Which type of topology describes the physical arrangement, installation, and connection of cables, computer, and other devices?
Nutka1998 [239]
<span>The network topology describes the physical arrangement, installation, and connection of cables, computer, and other devices.
The network topology can be bus topology (a</span><span> network topology that uses a single cable or conductor to connect all nodes on the network.) ,</span>star topology (a network topology in which cables running from each node connect to a single point, such as a hub.), ring (a network topology that consists of a single cable that runs continuously from node to node), mesh, hybrid, hub topology,... according the arrangement of the nodes. 

8 0
3 years ago
Read 2 more answers
If 10 ft lb of torque is applied at gear A, then what is the output torque at gear D?
Mrrafil [7]
This is actually simple math.
Use the formula of Gear A/Torque > 12.8ft/lb/10 > 1.28.
Therefor the output torque is 1.28 for gear D.
6 0
3 years ago
Select all that apply.
professor190 [17]
Social worker and legal aid worker

4 0
3 years ago
Read 2 more answers
What is mendix about?
fenix001 [56]

Answer:

Mendix is another word for appendix.

Explanation:

3 0
3 years ago
Other questions:
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • Explain the nature of documents that can be suitable for mergin
    12·1 answer
  • For which task is the WordArt gallery most useful?
    15·2 answers
  • Gap junctions and plasmodesmata have what feature in common?
    6·1 answer
  • Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed
    13·1 answer
  • Marys total out of pocket costbwere for the year​
    12·1 answer
  • Two of the major sources used today for obtaining information to create computer maps are satellites and _____________.
    11·2 answers
  • In what way, if any, are problems related to conflicts? Problems and conflicts are the same thing. Problems and conflicts are th
    9·1 answer
  • Can someone help me debug this please
    6·1 answer
  • What feature should you enable to prevent the sidhistory attribute from being used to falsely gain administrative privileges in
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!