About 2,320 results
Open links in new tab
  1. Factorial with a While Loop in Python - codingem.com

    To find factorial using a while loop in Python, multiply the result (starting at 1) by the number - 1 in a loop until the number reaches 1.

  2. Write factorial with while loop python - Stack Overflow

    Does anybody know how you can write a factorial in a while loop? I can make it in an if / elif else statement: num = ... factorial = 1 if num < 0: print("must be positive") elif num == 0: print("factorial = 1") else: for i in range(1,num + 1): factorial = factorial*i print(num, factorial)

  3. Factorial Program in Python using For and While Loop - The …

    Here you will get Python program to find factorial of number using for and while loop. The Factorial of a number is calculated by multiplying it with all the numbers below it starting from 1. For example, the factorial of 4 is 24 (1 x 2 x 3 x 4).

  4. Factorial of a Number – Python | GeeksforGeeks

    Apr 8, 2025 · The factorial of a number is the product of all positive integers less than or equal to that number. For example, the factorial of 5 (denoted as 5!) is 5 × 4 × 3 × 2 × 1 = 120. In Python, we can calculate the factorial of a number using various methods, such as loops, recursion, built-in functions,

  5. Factorial of a Number in Python Using While Loop - Newtum

    Sep 12, 2022 · In Python, you can calculate the factorial using a while loop. Here are some key applications of factorials, along with an example code snippet for calculating factorials using a while loop. Graph Theory: Factorials help in solving problems related to graph traversal and counting paths in a graph.

  6. Python Program to Find Factorial of a Number Using While Loop

    In programming, factorials can be calculated using various methods, and here we will focus on using a while loop in Python. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n , commonly denoted as n! .

  7. Using a while loop to calculate the factorial of user input

    Jul 2, 2021 · You must include the factorial and n inside the while loop while True: n = 1 factorial = 1 num=int(input("Enter number: ")) if num<=0: print("Thank you!") break while n<num: n+=1 factorial*=n print(factorial)

  8. Factorial Program in Python: Explained with Examples - Simplilearn

    Apr 12, 2025 · Factorial Program in Python Using While Loop. A Python program for calculating factorials using a `while` loop multiplies the numbers from 1 to the given input and accumulates their product iteratively. Example: def factorial(n): result = 1 while n > 0: result *= n n -= 1 return result # Example usage:

  9. Python Program to Find Factorial of a Number Using a Loop

    This Python program finds the factorial of a number using a loop. Definition of the Factorial Function? The factorial function is a mathematics formula represented by the exclamation mark "!". The formula finds the factorial of any number. It is defined as the product of a number containing all consecutive least value numbers up to that number.

  10. Python Program to Find Factorial of a Number Using While Loop

    Dec 27, 2022 · Python Program to find Factorial of a Number is used to calculate the factorial of a given number using While loop and prints the value in the output screen.

  11. Some results have been removed