Advertisement
Guest User

indutivo.py

a guest
Feb 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. fat = [0]*1000001
  4. fat[1] = 1
  5.  
  6. def ignorarZero(num):
  7.     for I in reversed(str(num)):
  8.         if I != '0':
  9.             return int(I)
  10.  
  11. for I in range(2, 1000000):
  12.     fat[I] = I*fat[I-1]
  13.     fat[I] = fat[I]
  14.     fat[I] = ignorarZero(fat[I])
  15.  
  16. #rodando
  17. instancia = 1
  18. while True:
  19.     try:
  20.         # print("Instancia {}".format(instancia))
  21.         n = int(input())
  22.  
  23.         print(fat[n],end=",")
  24.         instancia+=1
  25.  
  26.     except EOFError:
  27.         print("",end="\n")
  28.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement