Question

Below are a list of sequences of numbers. Your job is to program each sequence with...

Below are a list of sequences of numbers. Your job is to program each sequence with any loop of your preference (while, for, do/while). I want the code to output the sequence provided and the next number in the sequence (you can output more but there is 1 sequence that may only have 1 number after). Each sequence should be in the same main in one .cpp file. . Please order and notate each sequence in your output –. The output should also be horizontal like that shown below (if you output it vertically it will be -10pts). Each sequence should be programed with only 1 loop and optionally 1 selection statement. Hint: a selection statement may be used for the last 3 problems.

Series 1:

15, 14, 13, 12, 11, ...

Series 2:

1, 2, 5, 14, 41, ...

Series 3:

2, 3, 5, 8, 12, 17, ...

Series 4:

15, 13, 11, 9, 7, ...

Series 5:

71, 142, 283, 564, 1125, 2246, 4487, 8968, ...

Series 6:

10, 5, 1, -2, -4, -5, -5, -4, -2, ...

Series 7:

0, 1, 3, 7, 15, 31, 63, ...

Series 8:

0, 1, 4, 13, 40, 121, ...

Series 9:

15, 29, 56, 108, 208, 400…

series 10: (finite)

0, 1, 3, 6, 10, 10, 11, 13, 16, 16, 17, 19, 19, ...

series 11:

7, 9, 14, 20, 27, 33, 42, 52, 63, 73, 86, ...

Series 12:

13, -21, 34, -55, 89 ...

Series 13:

0, 1, 4, 12, 32, 80, 192, ...

The languague is C++. Please can you do it in one file and in an orderly manner.this the 3rd time am posting same question and still dont have the series.i need help especially from series 7 to 13 though i will be glad if you help me with all thanks alot

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<math.h>

#include<iostream.h>

void main()

{//series 7

int x =0,y=1;

int length = 20; //assumed for the length. Change as per your need

do

{

cout << x <<"," ;

x = x + (x+1)

length--

} while (length!=0)

// series 8

length =20;

x=0;

do{

cout << x <<"," ;

cout << y <<"," ;

int diff = y-x; //computes difference between two elements

x = y;

y = y+(3*diff);

length--;

}while(length!=0)

//series 9

x=15;

length = 20;

do{

cout << x <<"," ;

int count = 1;

y = x*2-count;

count = count*2;

length--;

}while(length!=0)

//series 10

x=0;

y=0;

length = 20;

while (length!=0)

{ //this is an additive series where series 0,1,2,3,4||0,1,2,3||0,1,2|| and so on is added

int maxcount =5;

int count = 0;

y=1;

if(count<maxcount)

{x = x+y;

y = y++;

while(count>0)

{

count++;

maxcount--;

}

while (count<=0)

{count--;

maxcount--;}

}

//series 13

x= 0;

y = 1;

for(i = 0;i<length;i++)

{

cout << x <<"," ;

x = x+pow(2,y);

y++;

}

Add a comment
Know the answer?
Add Answer to:
Below are a list of sequences of numbers. Your job is to program each sequence with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1 loop, and 1 selection Below are a list of sequences of numbers. Your job is...

    1 loop, and 1 selection Below are a list of sequences of numbers. Your job is to program each sequence with any loop of your preference (while, for, do/while). I want the code to output the sequence provided and the next number in the sequence (you can output more but there is 1 sequence that may only have 1 number after). . Each sequence should be in the same main in one .cpp file. . Please order and notate each...

  • Written in Java Your job is to produce a program that sorts a list of numbers...

    Written in Java Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers – at which point you should allow the user an option to choose to sort the numbers in ascending order via one of the three Sorting algorithms that we have explored. Your program should use the concept of Polymorphism to provide this sorting feature. As output, you will...

  • A Fibonacci sequence is a series of numbers where the next number in the series is...

    A Fibonacci sequence is a series of numbers where the next number in the series is the sum of the previous two numbers. The sequence starts with the numbers 0 and 1. Here are the first ten numbers of the Fibonacci sequence:             0 1 1 2 3 5 8 13 21 34 Write a Java program to print out the first fifteen numbers of the Fibonacci sequence using a loop. You will need three variables previous, current, and next...

  • For C++ Write a program that randomly generates 100 integers and sorts them using radix sort....

    For C++ Write a program that randomly generates 100 integers and sorts them using radix sort. Note: Your output would not be the same as this sample output due to the randomness. Sample output: 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7...

  • I need to create a C++ program to simulate a Round Robin Tournament. For example: if...

    I need to create a C++ program to simulate a Round Robin Tournament. For example: if a user enters 4, a 4 team tournament would output: 1 2 3 4 2 1 4 3 3 4 1 2 4 3 2 1 My goal is to create this program using a two dimentional array, however I am unsure how to go about doing initializing everything. How do I write a constructor for this? The following is the class declaration I...

  • Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays...

    Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...

  • 152 Chapter 7. Series 7.1 Investigating Series In this activity, you will experiment with some infinite sequences and their limits. Starting with a given sequence of numbers, {bi, b2. . . .], you wil...

    152 Chapter 7. Series 7.1 Investigating Series In this activity, you will experiment with some infinite sequences and their limits. Starting with a given sequence of numbers, {bi, b2. . . .], you will construct a new sequence {ai, a2. . . .} as follows: an b-b-1 Problems Repeat the activity, this time starting with the following sequence as (bn: 2 1 2 3 6 9 12 15 18 21 4 68' 10 12 14' 16 4. Compute the limit...

  • Give the numbers the reagent table for the sequence of reactions that will convert cycloheptanol to...

    Give the numbers the reagent table for the sequence of reactions that will convert cycloheptanol to alkene shown. In your answer, leave a space between each reagent number. 1. HNO3, H2SO4 2. PCC 3. Na2Cr207, H2S04 4. Br2, FeBr3 5. PBr3 6. H2C=0 7. Cuci 8. HBr 9. H20, H 10. CH3CH2CH2CI, AICI3 11. CH3CH2CH=PPH3 12. Zn-Hg, EtOH, HCI 13.LI, THE 14. 1. CH3CH2CH2MgCl 2. H20, H 15. KMnO4 QUESTION 8 0.3335 points Save Answer Give the numbers the reagent...

  • Write a complete C program that generate the following sequence of numbers in two ways. First,...

    Write a complete C program that generate the following sequence of numbers in two ways. First, the sequence of numbers should be made using a WHILE LOOP, then a DO-WHILE LOOP. 19, 15, 11, 7, 3, -1, -5, -9

  • Thank you Please show all work Thanks 76.) [ 10 pts ] Consider the two S-boxes...

    Thank you Please show all work Thanks 76.) [ 10 pts ] Consider the two S-boxes S1 and S2 of DES shown. Three hex digits (12 bits) are provided to these two S boxes. The higher order six bits are fed to S1 and the lower order six bits are fed to S2. For the six bits input to S1, the first and last bits are used to select the row, and the middle four bits are used to select...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT