Day 3: Python Program To Find The Factorial of An Integer

Python Program To Find The Factorial of An Integer

  • This tutorial will teach you how to compute and show the factorial of an integer.
  • A non-negative integer's factorial is the multiplication of all integers less than or equal to n. For example, the factorial of 5 is 5*4*3*2*1 = 120.

Formula:

  • n! = n*(n-1)*(n-2)*........*1

Using Loop

Output:

  • The factorial of 6 is 720.

Using Recursion

Output:

  • A factorial of 5 is 120




Comments