Question

In: Computer Science

The language is C++ Below are a list of sequences of numbers. Your job is to...

The language is C++

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).. 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, ...

Solutions

Expert Solution

Coding

#include <iostream>
using namespace std;
int main(){
   int j,sum;
   //Seriese 1 15, 14, 13, 12, 11, ...
cout<<"Seriese 1"<<endl;
for(int i=15; i>=10; i--){
cout<<i<<",";
}
cout<<endl<<"Seriese 2"<<endl;
sum=3;
j=0;
cout<<"1"<<","<<"2"<<",";
for(int i=2; i<=41;){
   j=i+sum;      
       cout<<j<<",";
       sum=sum*3;
       i=j;
}

cout<<endl<<"Seriese 3"<<endl;
j=0;
sum=2;
for(int i=0; i<=6; i++){
   sum=sum+i;
   cout<<sum<<",";
}
cout<<endl<<"Seriese 4"<<endl;
for(int i=15; i>=4; i=i-2){
   cout<<i<<",";
}

return 0;
}

output:

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........


Related Solutions

reverse_number_in_list(number_list:list)-> list This function will be given a list of numbers your job is to reverse...
reverse_number_in_list(number_list:list)-> list This function will be given a list of numbers your job is to reverse all the numbers in the list and return a list with the reversed numbers. If a number ends with 0 you need to remove all the trailing zeros before reversing the number. An example of reversing numbers with trailing zeros: 10 -> 1, 590 -> 95. None of the numbers in the number_list will be less than 1. Example: number_list = [13, 45, 690,...
Language C: Suppose you are given a file containing a list of names and phone numbers...
Language C: Suppose you are given a file containing a list of names and phone numbers in the form "First_Last_Phone." Write a program to extract the phone numbers and store them in the output file. Example input/output: Enter the file name: input_names.txt Output file name: phone_input_names.txt 1) Name your program phone_numbers.c 2) The output file name should be the same name but an added phone_ at the beginning. Assume the input file name is no more than 100 characters. Assume...
**C++ Programming Language** a program that computes the average of a collection of numbers and then...
**C++ Programming Language** a program that computes the average of a collection of numbers and then outputs the total number of values that are greater than the average. The objective of this assignment is to select a language that you have never used before and modify the program from the text so that it outputs the number of A's, B's, C's, D's and F's. An A grade is any score that is at least 20% greater than the average. The...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times,...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times, each time using a different syntax to define the list. Write a while loop that prints the numbers from 1 to 10. Convert your previous loop into a for loop. Rewrite your for loop to only have one number in the range. Write a for loop to print out each item of your list of 10 numbers, all on the same line, separated by...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times,...
In Python syntax, create a list of 10 numbers (any numbers). Create your list 3 times, each time using a different syntax to define the list. Write a while loop that prints the numbers from 1 to 10. Convert your previous loop into a for loop. Rewrite your for loop to only have one number in the range. Write a for loop to print out each item of your list of 10 numbers, all on the same line, separated by...
Using R language: Given a vector or list of numbers, call this variable x , write...
Using R language: Given a vector or list of numbers, call this variable x , write down the code that will create a new vector, y , where all the odd number entries are set to 0. In other words, the first, third, fifth, etc entries should all be 0.
C++ programming language. Write a program that will read in id numbers and place them in...
C++ programming language. Write a program that will read in id numbers and place them in an array.The array is dynamically allocated large enough to hold the number of id numbers given by the user. The program will then input an id and call a function to search for that id in the array. It will print whether the id is in the array or not. Sample Run: Please input the number of id numbers to be read 4 Please...
JavaScript (HTML) Task: Please read 10 numbers that are list below, sort the numbers and then...
JavaScript (HTML) Task: Please read 10 numbers that are list below, sort the numbers and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} [Reference JavaScript code] <html> <body>     <H1>prompt()</h1>     <p id="pro"></p>     <script>        // Array creation        var num= new Array();               var ix = 0;        // Read 10 numbers        for (ix = 0; ix < 10; ix++)        {num[ix] = prompt("Enter a number");...
*** C language *** Make a  list of all of the different zip codes that the zombies...
*** C language *** Make a  list of all of the different zip codes that the zombies live at and a count of how many zombies live at that zip code. The list should be sorted based on the zip code with the smallest zip code printed first. Example: Zip Code # Zombies 31234 2 //variables int zip[] = {37643,31234,32785,32643,32785,32643,31234,31234,32643,32643,31234,32785,32785,32643,31234}; char zombie[]={'N','Y','Y','N','Y','Y','Y','N','Y','Y','N','Y','Y','Y','Y'}; Y = zombie N = Not zombie int zPatient = 0; int nonZpatient = 0; for(int pt = 0;...
Provided is a list of numbers. For each of the numbers in the list, determine whether...
Provided is a list of numbers. For each of the numbers in the list, determine whether they are even. If the number is even, add True to a new list called is_even. If the number is odd, then add False. num_lst = [3, 20, -1, 9, 10] **Please use Python**
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT