Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write in c++ PART 4: One more One (www.projecteuler.net) (25 points) (www.projecteuler.net) Consider the following process that can be applied recursively to any positive
Please write in c++
PART 4: One more One (www.projecteuler.net) (25 points) (www.projecteuler.net) Consider the following process that can be applied recursively to any positive integer n: if n=1, do nothing and the process stops, if n is divisible by 7, divide it by 7, otherwise add 1. . The write a console program that constantly takes in a number n from the console and outputs to the console the number of 1's that must be added to the positive integer n before the process above ends. Make sure that your code detects numbers entered that are less than or equal to 0. All your source code for this part needs to be a file called lab1part4.cc Sample Sequence: +1 +7 +1 +1 +1 +7 +1 +1 +1 +1 +7 125 126 7 18 19 20 21+354 56+731 Example Input/Output: Please enter the starting number n: 125 The sequence had 8 instances of the number 1 being added Please enter the starting number n: 0 Invalid entry the number must be greater than 0Step 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