Computer Science, asked by tiwari7423, 11 months ago

Create a function factorial(x) that takes an integer and returns the product of all the positive integers less than or equal to n.

Answers

Answered by Abhis506
0

Answer is in the attachment

Attachments:
Answered by mindfulmaisel
0

Factorial of a number using function in python:

Explanation:

CODE:

def factorial(x):

fact=1

for i in range(1,x+1):

   fact=fact*i

print("The factorial is:",fact)

a=int(input("Enter an integer:"))

factorial(a)

OUTPUT:

Enter an integer: 7

The factorial is: 5040

ALGORITHM:

1. Start the program

2. Get the value

3. Call Factorial (a)

4. Set Fact=1

5. For i in range (1, x+1)

  5.1. Set fact=fact*i

6. Print the result

7. Stop the program

TO KNOW MORE:

1.Write the python program to find whether the number is a palindrome or not?

brainly.in/question/12567722

2.Write a Python program to check if a given number is an Armstrong number.

brainly.in/question/8166371  

Similar questions