Hi I need help writing this program

The factorial, n!, of an integer is defined to be:

n! = ( n * ( n - 1 ) * ( n - 2 ) * ….. * 2 * 1 )

An application of this formula is as follows, 5! = 5 * 4 * 3 * 2 * 1 = 120. This month’s challenge is to find the rightmost non-zero digit of n!. From the above example this number is 2. The rightmost non-zero digit of 12! ( 12! = 479001600 ) is 6.

Write a program that will input an integer between 1 and 14 inclusive and output the rightmost non-zero digit of the factorial. For an added challenge, handle inputs between 1 and 5000 inclusive.

Here are a few test cases for you to try:

Factorial Rightmost Non-Zero Digit

5 - 2

21 - 4

789 - 4

1000 - 2

4013 - 8

thanks for the help