• Python program to find factorial of a number without using recursion in python.
  • Algorithm to find factorial of a number without using recursion function using python.

#1: Python program to find factorial of a given number without using recursion

  1. #Factorial without recursion

  2. n=int(input("Enter the number: "))
  3. fact=1
  4. if n<0:
  5.     print("factorial doesn't exist for negative numbers")
  6. else:
  7.     for i in range(1,n+1):
  8.         fact=fact*i
  9.     print("factorial of", n, "is", fact)

Output:

  1. Enter the number: 5
  2. factorial of 5 is 120





You Might like :
  1. Python try except else with example program
  2. Python finally block example with program
  3. Python try-except- else vs finally with example program
  4. Find factorial of a number without using recursion using python
  5. Python program to find factorial without recursion
  6. If statement in python example program
  7. Else statement in python with example program
  8. Types of operators in python
  9. python math operators
  10. python division operator
  11. Python modulo operator
  12. Python bitwise operators
  13. python comparison operators
  14. Logical operators in python
  15. Assignment operator in python
  16. Identity operator in python
  17. Python power operator
  18. Not equal operator in python
  19. python not operator
  20. python and operator
  21. python Ternary operator
  22. python string operations
  23. python string methods
  24. Spilt function in python
  25. Format function in python
  26. String reverse in python
  27. python tolower
  28. Remove spaces from string python
  29. Replace function in python
  30. Strip function in python
  31. Length of string python
  32. Concat python
  33. startswith python
  34. strftime python
  35. is numeric python
  36. is alpha python
  37. is digit python
  38. python substring


Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

1 comments for Python program to find factorial without recursion

Select Menu