Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ problem please help. Thank you One such property is an integer's additive persistence and its resulting additive root (http://mathworld.wolfram.com/AdditivePersistence.html). Additive persistence is a property

C++ problem

image text in transcribed

please help.

Thank you

One such property is an integer's additive persistence and its resulting additive root (http://mathworld.wolfram.com/AdditivePersistence.html). Additive persistence is a property of the sum of the digits of an integer. The sum of the digits is found, and then the summation of digits is performed creating a new sum. This process repeats until a single integer digit is reached. Consider the following example: 1. The beginning integer is 1234 2. Sum its digits is 1+2+3+4-10 3. The integer is now 10 4. The sum of its digits is 1 +0 1 5. The integer is 1. When the value reaches a single digit, we are finished. This final integer is the additive root The number of cycles is the additive persistence. The integer 1234 has an additive persistence of 2 (first sum was 10, then the second sum was 1). The final digit reached is called the integer's additive root. The additive digital root of 1234 is 1 Program Specifications The program should run as follows 1) Program takes in a single long from input, the number being checked a. if the input long is 0 or less, print the single work "Eiror" and end the program 2) Otherwise, the output should be two space separated longs a. the persistence b. the additive root 3) If the input long is a single digit, report its additive persistence as 0 and its additive root is the input number. 4) Otherwise calculate the additive persistence

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

Students also viewed these Databases questions

Question

Azure Analytics is a suite made up of which three tools?

Answered: 1 week ago