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
Write a Python program string_functions.py that defines several functions. Each function re-implements Python's built-in string
Svetach [21]

Answer:

def length( mystring):

   count = 0

   for i in mystring:

       count += 1

   return count

def reversed( mystring):

   strlist = []

   for i in range(length(mystring)):

       strlist.append(mystring[(length(mystring) - 1) - i])

       txt = "".join(strlist)

   return txt

string = 'Yolanda'

print(reversed(string))

Explanation:

The python module defines two functions 'reversed' and 'length'. The length function counts the number of characters in a string variable while the reversed function reverses the string variable value.

3 0
2 years ago
what is the name of the fields in an x.509 digital certificate that are used when the parties negotiate a secure connection?
Zigmanuir [339]

Answer:

Image result for what is the name of the fields in an x.509 digital certificate that are used when the parties negotiate a secure connection?

Common applications of X. 509 certificates include SSL/TLS and HTTPS for authenticated and encrypted web browsing, signed and encrypted email via the S/MIME protocol, code signing, document signing, client authentication, and government-issued electronic ID.

Explanation:

8 0
3 years ago
What does clicking and dragging the fill handle in excel
Olegator [25]

Answer:

The fill handle copies the same values, formulas, or fills a series of dates, texts, numbers, and other data to a desired number of cells. ... Click and hold the handle, then you can drag up, down, across over other cells. When you release your mouse button, it auto-fills the content to the cells you dragged over.

5 0
2 years ago
What is a computer that provides services and connections to other computers on a network is called a ________ ?
melisa1 [442]
They are called servers .. you can also call them hosts
6 0
3 years ago
Consider Ron’s budget. How much money does Ron have left over each month?
vladimir1956 [14]
What is Ron’s budget?
4 0
2 years ago
Read 2 more answers
Other questions:
  • Question 5
    5·1 answer
  • A trojan horse
    12·1 answer
  • In reduced visibility conditions you need to work especially hard to gather visual information because
    7·1 answer
  • If the physical memory size is doubled without changing any of its other parameters, the number of entries in the page table
    5·1 answer
  • Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
    13·1 answer
  • Photoshop files are generally small in size. True or false
    13·1 answer
  • In the past, workers would usually complete ______. a. A variety of tasks on a daily basis b. The same tasks every day c. Thinki
    9·2 answers
  • Can you anyone please help me​
    13·1 answer
  • PLEASE HELP ME!!!
    13·1 answer
  • Would my phone still work if I snapped it in half?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!