Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started