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
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 27 ---- 14 ---- 4 4000 ---- 0 9 The number of times products need to be calculated to reach a single digit is called the persistence number of that integer. Thus, the persistence number of 715 is 3, the persistence number of 27 is 2, the persistence number of 4000 is 1, and the persistence number of 9 is 0. You are to write a program that will continually prompt the user to enter a positive integer until EOF has been entered via the keyboard. For each number entered, your program should call a persistence function. The result from calling persistence should be displayed to the user.
Step 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