Last active
August 29, 2015 14:16
-
-
Save gilrg18/f9f5a9fe4b1842fcda3c to your computer and use it in GitHub Desktop.
Factorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Gilberto Rogel García A01630171 | |
def fact(n): | |
n=n | |
a=1 | |
while (n>1): | |
a=a*n | |
n=n-1 | |
return (a) | |
x="y" | |
while(x=="y"): | |
n=int(input("Dame un numero POSITIVO y te dare su factorial:")) | |
f=fact(n) | |
while (n<0): | |
n=int(input("Por favor dame un numero POSITIVO:")) | |
f=fact(n) | |
print("El factorial de tu numero es:",f) | |
x=str(input("Quieres intentar otro numero? y=si, n=no:")) | |
while (x!="y" and x!="n"): | |
print ("Error") | |
x=str(input("Quieres intentar otro numero? y=si, n=no:")) | |
print("Le deseo un buen dia") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment