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
Any mobile devices contain a(n) ___ and gyroscope that can sense even the smallest movements.
mars1129 [50]

Any mobile device contains a(n) accelerometer and gyroscope that can sense even the smallest movements.

<h3>What are accelerometers? What does an accelerometer sensor do in mobile phones?</h3>

The orientation of a mobile phone is determined by the accelerometer in the device. The gyroscope, or gyro for short, tracks rotation or twist to provide another dimension to the data provided by the accelerometer.

A smartphone's built-in accelerometer measures the device's acceleration. It tracks the different motions like shaking, tilting, swinging, and rotating and accordingly changes the orientation of your app. The accelerometer utilizes the value of XYZ to determine and detect motion.

To know more about accelerometer , Visit:

<u>brainly.com/question/27960990</u>

#SPJ4

7 0
1 year ago
Which type of image is not a supported using the Online Pictures or Insert Picture command?
IgorC [24]

Answer:

HTML  i think

Explanation:

4 0
2 years ago
Read 2 more answers
What is displayed on the console when running the following program?
Andre45 [30]

Answer:

The answer is "Option A"

Explanation:

In the given java code, a class "Test" is defined, inside the main method try and catch block is used, inside the try block method "p()" is called, that print a message. in this block two catch block is used, that works on "NumberFormatException" and "RuntimeException".  In the method "p" declaration, a string variable "s" is defined, that holds double value, that is "5.6", and converts its value into the wrong integer, and other wrong option can be described as follows:

  • In option B, it is wrong, it is not followed by after call method.
  • In option C, It is not followed by runtime exception, that's why it is incorrect.
  • Option D and Option E both were wrong because they can't give run time and compile-time error.  
6 0
3 years ago
They predicted another cold day in Seattle. They predicted another windy day in Seattle. Combine the sentences into one sentence
VLD [36.1K]

Answer:

They predicted another cold day in Seattle and another windy day in Seattle.

4 0
3 years ago
How can the font type of an existing style named No Spacing be changed?
sergejj [24]

Answer: it depends on the font size

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
  • To add text to a slide when using presentation software, you need to add a text box. To add a text box, click the Text Box butto
    6·2 answers
  • A ________ is hardware or software that acts as a filter to prevent unwanted packets from entering a network.
    9·2 answers
  • How to make the heart symbol in photoshop
    13·2 answers
  • What field in a TCP segment is used to determine if an arriving data unit exactly matches the data unit sent by the source?
    11·1 answer
  • A Network Attached Storage device is good for _____.
    11·2 answers
  • What are the physical aspect of a presentation​
    7·1 answer
  • What is a feature of readable code?
    12·2 answers
  • Which of the following is an advantage of using
    6·2 answers
  • I need a C++ program to ask the user to put in different numbers until zero is pressed then the program counts the numbers that
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!