Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions