Question: 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:

Multiplying the digits of an integer and continuing the process gives the

output:

surprising result that the sequence of products always arrives at a single-digit

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!