proizvod
Let P be the product of all numbers from 1 to N. Write a program that calculates the last non-zero digit of number P .
InputThe first and only line of standard input contains the number N (1 <= N <= 10000).
OutputThe standard output should contains the last non-zero digit of number P .
Input:
Output:
Note: 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 = 3628800 and the last non-zero digit is 8.
10Output:
8Note: 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 = 3628800 and the last non-zero digit is 8.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.