HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50368 - Right-most non zero digit in N!

Guest
• Discussion of problem (2)

Section problems

• 50649 - Puzzle
• 50321 - Missing Number
• 50308 - IT Knowledge Seminars
• 50310 - Kinetic Energy
• 50314 - Falling Distance
• 50316 - Population Bar Chart
• 50530 - Sum of Ratios
• 50384 - Permutations revisited
• 50368 - Right-most non zero di...
• 50293 - Sum of odd numbers from ...
• 50365 - Sum of the numbers from a...
• 50388 - Number of Armstrong Num...
• 50363 - Class GPA Average
• 50390 - Total Salary Paid
• 50392 - How much space
• 50394 - Water Bills
• 50651 - Largest power of two

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

The right-most non zero digit in N!

Question:
Write a program which shows the right-most non-zero digit in N! where N is a positive integer less than 32000. For example:

  • 5!=120 ==> right-most non zero digit is 2
  • 7!=5040 ==> right-most non zero digit is 4
  • 10!=368800 ==> right-most non zero digit is 8

Input specification
You are given an integer (N) where is 1 ≤ N ≤ 32,000.

Output specification
Show right most non-zero digit in N!

 Sample Input I     Sample Input II   
 345
 1000
 Sample Output I     Sample Output II   
 8
 2


Для отправки решений необходимо выполнить вход.

www.contester.ru