Advertisement
roneygomes

Fatorial Recursivo

Dec 8th, 2011
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. def fat(valor):
  5.     if valor == 1 or valor == 0:
  6.         return 1
  7.     else:
  8.         return valor * fat(valor - 1)
  9.  
  10.  
  11. numero = int(raw_input("Entre com um número: "))
  12. print "O fatorial desse número é:", fat(numero)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement