Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 0

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

Step: 3

blur-text-image

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions