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
What is the name of the unique identifier assigned to any personal computer that is connected to the internet?
Stolb23 [73]
There is no truly unique identifier assigned to a PC. Any appearance of a unique ID is merely an illusion. The closest thing there is to a unique identifier is a MAC address, which is actually assigned to a network adapter (Ethernet port, wireless radio, etc.) and is usually unique but can be faked
7 0
3 years ago
Which machine will work best to dig a hole in the soil?
sertanlavr [38]
I think the correct answer from the choices listed above is option A. The machine that will work <span>best to dig a hole in the soil would be a screw. The other two choices are not really used to dig a hole in the soil. Hope this answers the question. Have a nice day.</span>
8 0
3 years ago
Blender is used by which video game team member?
prohojiy [21]

Answer:

The 2nd one

Explanation:

6 0
3 years ago
D) Informal high level descuption of an algorithm in english kcalled
Hatshy [7]
It might be d I’m not sure die
8 0
3 years ago
Read 2 more answers
Which set of variables will make code easier to understand?
Alecsey [184]

Answer:

sum, price, count

Explanation:

Programmers should use significant names for the variables.

Not only it makes it easier for them to remember what kind of information is stored in each variable, but it also makes life simpler for anyone who would read the code later.

Names like sum, price and count are significant names ( assuming they actually hold this kind of data), and will make the re-reading of the program code much easier.

8 0
3 years ago
Other questions:
  • Which of the following refers to a marketing metric that shows an event that occurs on a Web page met a predefined goal associat
    6·1 answer
  • Why is the Vigenere cipher hard to crack? (select 2)
    6·1 answer
  • A _______ file is a type of vector graphics file created specifically for Windows.
    13·2 answers
  • Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "
    6·1 answer
  • When configuring services, what linux directory typically contains server configuration files?
    8·1 answer
  • Which custom configuration is most likely to include a raid array?
    14·1 answer
  • Why is ssh preferred over telnet for remote connections?
    10·1 answer
  • CORRECT ANSWER GETS BRAINLIEST
    8·2 answers
  • What is the best way of farming exotics in destiny?
    12·2 answers
  • I WILL GIVE MOST BRAINLY
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!