Skip to content

Instantly share code, notes, and snippets.

@gilrg18
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilrg18/f9f5a9fe4b1842fcda3c to your computer and use it in GitHub Desktop.
Save gilrg18/f9f5a9fe4b1842fcda3c to your computer and use it in GitHub Desktop.
Factorial
#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