Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Multiplying the digits of an integer and continuing the process gives the surprising result that the sequence of products always arrives at a single-digit number.

Multiplying the digits of an integer and continuing the process gives the surprising result that the sequence of products always arrives at a single-digit number. For example, 715 35 15 5, 88 64 24 8, 27 14 4, etc. The number of products necessary to reach the single-digit is called the persistence number of that integer. Thus, 715 and 88 have persistence 3, while 27 has persistence 2. Write a program that will read an unknown number of unsigned ints from the standard input device.

How can I write the code to get this output?

Input:

image text in transcribed

output:

image text in transcribed

715 88 27 100 2147483647 2147483648 999 1234 12345 123456 1234567 12345678 123456789 1234567890 715 -> 35 -> 15 -> 5 persistence = 3 88 -> 64 -> 24 -> 8 persistence = 3 27 -> 14 -> 4 persistence = 2 100 -> O persistence = 1 2147483647 -> 903168 -> O persistence = 2 2147483648 -> 1032192 -> O persistence = 2 999 -> 729 -> 126 -> 12 -> 2 persistence = 4 1234 -> 24 -> 8 persistence 2 12345 -> 120 -> O persistence 2 123456 -> 720 -> 0 persistence = 2 1234567 -> 5040 -> O persistence = 2 12345678 -> 40320 -> O persistence 2 123456789 -> 362880 -> O persistence 1234567890 -> O persistence 1 = N

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions