Product of digits P61061


Statement
 

pdf   zip

html

Write a program that reads several numbers, and for each one prints the product of its digits, and the product of the digits of the latest product, etcetera, until the resulting product has just one digit.

Input

Input consists of several natural numbers.

Output

For every number, print the product of the digits of the number, the product of the digits of the previous product, etcetera, one per line, until the resulting product has just one digit. Print a line with 10 dashes after the output for every number.

Public test cases
  • Input

    939393
    3737
    999999999
    7
    

    Output

    The product of the digits of 939393 is 19683.
    The product of the digits of 19683 is 1296.
    The product of the digits of 1296 is 108.
    The product of the digits of 108 is 0.
    ----------
    The product of the digits of 3737 is 441.
    The product of the digits of 441 is 16.
    The product of the digits of 16 is 6.
    ----------
    The product of the digits of 999999999 is 387420489.
    The product of the digits of 387420489 is 0.
    ----------
    The product of the digits of 7 is 7.
    ----------
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python