I recently answered something similar.
Java function to find numbers
It is necessary to have a function that allows to obtain the digits.
Function taken from here.
link
#include <math.h>
int getDigit(int number, int k)
{
return (number/(int)pow(10,k-1))%10;
}
So now we have to do that, as long as it has more than one digit, something happens. That is, as long as it is greater than or equal to 10.
Note: I copy something similar to what I had in the capicúa's question.
while(numero>=10)
{
int acumular = 1;
int longitud = (int)log10(numero);
for (int i = 0; i < longitud; i++)
{
acumular *= obtenerDigito(numero,i);
}
numero = acumular;
}
This works only for integers less than 2 raised to 31, that is, about 2 billion, due to the limitation of the architecture, that is, but I think it is more than enough.