Question: Develop a C++ program that fulfills the following requirements: Generate the first 100 values in our sequence following the sequencing rules Store all of the

Develop a C++ program that fulfills the following requirements:

  • Generate the first 100 values in our sequence following the sequencing rules
  • Store all of the first 100 values of our sequence in an integer array
  • Using your array/vector, output each of the 100 values to the screen, with tabs separating each value
  • Using your array/vector, output each of the 100 values to a text file, with spaces separating each value

Let's develop a program that will produce and output the first 100 values in my newest sequence.

C(0) = 1

C(1) = 3

C(n) = IF n IS DIVISIBLE BY 3

THEN C(n) = C(n-1) + C(n-2)

ELSE IF n IS DIVISIBLE BY 2

THEN C(n) = C(n-1) / 2

ELSE

C(n) = n

NOTE: Think of the modulus operator for divisibility checks NOTE: Make sure to always use integer division where needed

Here are the first few values of the sequence: 1 3 1 4 2 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!