Write a program to find a factorial of a given number.
6! = 720, 5! = 120, 4! = 24
- Try to solve it in a most simple and efficient way.
- Share your codes in the comments (in any language), I'll find some bugs 😉.
- Feel free to mention if you find any bugs in my code 🧐.
- Share some challenges in the comments, I'll solve them in my next blog post.
- Never see my code before solving it on your own.
import math num = 5 print(math.prod([i for i in range(1, num + 1)]))
I've used Python for solving this challenge, but if you want the same solution in some other languages let me know in the comments 👇.