Page 67 - PYTHON-12
P. 67

Program 4:  Write a Program to find factorial of the entered number.

               Solution:


               #Program to calculate the factorial of an inputted number (using while loop)

               num = int(input("Enter the number for calculating its factorial : "))

               fact = 1


               i = 1

               while i<=num:


                   fact = fact*i

                   i = i + 1

               print("The factorial of ",num,"=",fact)

































               Program 5:  Write a Program to enter the number of terms and to print the Fibonacci
               Series.

               Solution:

               #fibonacci


               i =int(input("enter the limit:"))

               x = 0
   62   63   64   65   66   67   68   69   70   71   72