Answers for "fakultät python"

0

fakultät python

def factorial(num): 
    if num < 0: 
        print("Factorial of negative num does not exist")
    elif num == 0: 
        return 1
    else: 
        fact = 1
        while(num > 1): 
            fact *= num 
            num -= 1
        return fact 
num = 5; 
print("Factorial of",num,"is", factorial(num))
Posted by: Guest on July-14-2021
0

fakultät python

def factorial(n): 
    return 1 if (n==1 or n==0) else n * factorial(n - 1);  
num = 5; 
print("Factorial of",num,"is", factorial(num))
Posted by: Guest on July-14-2021
0

fakultät python

pythonCopydef factorial(num): 
    if num < 0: 
        print("Factorial of negative num does not exist")

    elif num == 0: 
        return 1
        
    else: 
        fact = 1
        while(num > 1): 
            fact *= num 
            num -= 1
        return fact 

num = 5; 

print("Factorial of",num,"is", factorial(num))
Posted by: Guest on July-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language