import os
os.system("clear")
def factorial(n):
if n == 0:
return 1
else:
return n*factorial(n-1)
return x
def factorialN():
op=1
while op !=2:
print("<<-- Factorial de un numero N -->>")
try:
n = int(input("Ingrese un numero entero: "))
os.system("clear")
result = factorial(n)
os.system("clear")
print("<<-- Resultado -->>")
print("El Factorial de {0} es {1}".format(n, result))
print("-------------------")
print("1-Calcular otro numero")
print("2-Salir")
op = int(input("Ingrese opcion: "))
except(ValueError, NameError,SyntaxError):
os.system("clear")
print("ERROR- Ingrese numeros enteros")
if __name__=="__main__":
factorialN()
os.system("clear")
def factorial(n):
if n == 0:
return 1
else:
return n*factorial(n-1)
return x
def factorialN():
op=1
while op !=2:
print("<<-- Factorial de un numero N -->>")
try:
n = int(input("Ingrese un numero entero: "))
os.system("clear")
result = factorial(n)
os.system("clear")
print("<<-- Resultado -->>")
print("El Factorial de {0} es {1}".format(n, result))
print("-------------------")
print("1-Calcular otro numero")
print("2-Salir")
op = int(input("Ingrese opcion: "))
except(ValueError, NameError,SyntaxError):
os.system("clear")
print("ERROR- Ingrese numeros enteros")
if __name__=="__main__":
factorialN()
0 comentarios:
Publicar un comentario