diff --git a/Python Program for factorial of a number b/Python Program for factorial of a number index 6bfc0809621..fb75b99de87 100644 --- a/Python Program for factorial of a number +++ b/Python Program for factorial of a number @@ -1,8 +1,13 @@ -Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 6 is 6*5*4*3*2*1 which is 720. +""" +Factorial of a non-negative integer, is multiplication of +all integers smaller than or equal to n. +For example factorial of 6 is 6*5*4*3*2*1 which is 720. +""" +""" Recursive: -# Python 3 program to find -# factorial of given number +Python3 program to find factorial of given number +""" def factorial(n): # single line to find factorial @@ -10,11 +15,12 @@ def factorial(n): # Driver Code num = 5; -print("Factorial of",num,"is", -factorial((num)) +print("Factorial of",num,"is", factorial((num))) + +""" Iterative: -# Python 3 program to find -# factorial of given number +Python 3 program to find factorial of given number. +""" def factorial(n): if n < 0: return 0 @@ -29,5 +35,4 @@ def factorial(n): # Driver Code num = 5; -print("Factorial of",num,"is", -factorial(num)) +print("Factorial of",num,"is", factorial(num))