#39 Python Tutorial for Beginners | Factorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024

ความคิดเห็น • 282

  • @satyammhetre2832
    @satyammhetre2832 4 ปีที่แล้ว +61

    insted of telusko learnings it should be telusko blessings

  • @rajatbansal5137
    @rajatbansal5137 3 ปีที่แล้ว +9

    def main():
    a = int(input("enter the number"))
    def factorial(n):
    print()
    b =1
    for i in range(1, a + 1):
    b = b * i
    print(b)
    c = input("want to find for onother number=")
    if c == "y" or c == "yes":
    main()
    factorial(a)
    main()

  • @chessbd
    @chessbd ปีที่แล้ว +6

    This programming example is well thought out and kinda refreshing! It helps me to get back to tutorial again!. thanks for your selfless act.

  • @ritikasharma7849
    @ritikasharma7849 4 ปีที่แล้ว +42

    No one can beat you in teaching python thanku ❤️

    • @hellobro495
      @hellobro495 4 ปีที่แล้ว +2

      Maybe i can

    • @HarryPotter-ws4fr
      @HarryPotter-ws4fr ปีที่แล้ว

      @@hellobro495 bro im from non coding background .past one week im lerning python.but still i cant write a single code. can you teach me

  • @gouripeddipawansreekar1752
    @gouripeddipawansreekar1752 3 ปีที่แล้ว +13

    factorial without functions::
    x = int(input("enter a number"))
    z=1
    while x>0:
    z=z*x
    x=x-1
    print("factorial of x is",z)

    • @ritamsantra2372
      @ritamsantra2372 2 ปีที่แล้ว +4

      n=int(input("enter the range"))
      N1=1
      For I in range(1, n+1)
      N1=N1*i
      Print(N1)
      I think it's the easiest process

    • @Rajadahana
      @Rajadahana 2 ปีที่แล้ว +2

      Just did a few little tweakings to your code with a for loop and didn't use ".format" at the end to show the output
      x = int(input("enter a number"))
      z=1
      for i in range(1,x+1):
      z*=i
      print("factorial of", x, "is",z)
      Hope you would like this as well. One more thing use *= instead of z=z*x.

  • @gokceozkul3522
    @gokceozkul3522 4 ปีที่แล้ว +7

    I feel sorry for the first time on youtube about forget to like videos. Thank youuuuu!!!!

  • @karthikkeyansmk2727
    @karthikkeyansmk2727 4 ปีที่แล้ว +1

    factorial in my way sir!
    def facto(num):
    e = 1
    for i in range(1,num+1):
    e *= i
    print("factorial of ",num,'! is ',e)
    user = int(input("Enter which number factorial you want : "))
    facto(5)

  • @shaunakshukla7984
    @shaunakshukla7984 5 หลายเดือนก่อน +1

    n=int(input("enter any no"))
    def fact(n):
    for i in range(1,n):
    n=n*i
    print(n,end=" ")
    fact(n)
    output
    enter any no 5
    5 10 30 120

  • @letuslearntogether7000
    @letuslearntogether7000 4 ปีที่แล้ว +4

    you got great acting skills n also you have an amazing future in cinema man

  • @edisonjoshua2292
    @edisonjoshua2292 5 ปีที่แล้ว +3

    k = int(input("Enter the number to calculate the factoroial "))
    j = 1
    for i in range(1,k+1):
    j = i * j
    print ("The factorial of " ,k, "is", j)

    • @hellobro495
      @hellobro495 4 ปีที่แล้ว

      Great buddy!!!

    • @hellobro495
      @hellobro495 4 ปีที่แล้ว

      Great buddy!!!

    • @souravpaul7677
      @souravpaul7677 4 ปีที่แล้ว

      What If user inputs 0 as the value 🤨

  • @BhuveshDhiman
    @BhuveshDhiman 5 ปีที่แล้ว +6

    def fac(n):
    if n==0:
    return 1
    s=1
    for i in range(1,n+1):
    s=s*i
    return s
    n=int(input("Enter a no."))
    ans=fac(n)
    print("Factorial = ",ans)

  • @rameshbanoth8794
    @rameshbanoth8794 8 หลายเดือนก่อน

    factorial of a number
    def fact(n):
    x=n
    for i in range(1,n):
    x*=(n-i)
    return x
    result=fact(5)
    print(result)

  • @kevernspann8121
    @kevernspann8121 4 ปีที่แล้ว

    def fib(n, s=1):
    a = 0
    b = 1
    if n

  • @ElyasSAhmad
    @ElyasSAhmad 4 ปีที่แล้ว +2

    z = int(input('enter the number which you waant to find the factorial of it: '))
    c = 1
    d = 2
    for a in range(z-1):
    b = c * d
    c = b
    d +=1
    if z

  • @sumankumarkarmakar2106
    @sumankumarkarmakar2106 5 ปีที่แล้ว +1

    def fact(n):
    if n < 0:
    print('Should be +ve number')
    else:
    a = 1
    for i in range (1, n + 1):
    a = a * i
    return a
    x = int(input('give a number for factorial = '))
    result = fact(x)
    print('the factorial of ', x, 'is = ', result)

  • @srishtiandutkarsh1460
    @srishtiandutkarsh1460 6 ปีที่แล้ว +12

    Sir i a getting errorwhile executing this code

  • @Killa07
    @Killa07 4 ปีที่แล้ว +3

    Easiest Answer
    x = int(input("Enter a Number: "))
    result = 1
    for i in range(x):
    result = result * (x - i)
    print(result)

    • @jimmylaze
      @jimmylaze 3 ปีที่แล้ว

      GJ Jonty, you put these frauds to shame

  • @ashu60071
    @ashu60071 4 ปีที่แล้ว +3

    Telusko you are a blessing.

  • @vikrantchouhan9908
    @vikrantchouhan9908 3 ปีที่แล้ว +6

    Another awesome video! I also watched the one that accomplishes this by recursion. Howeverm in this particular video, I would suggest to include the conditions to take care of negative integers, 0 and 1 as the argument values.

    • @Mlbbmontage131
      @Mlbbmontage131 2 ปีที่แล้ว

      def factorial():
      j = 1
      valid = False
      while not valid:
      try:
      x = int(input("Enter value to find factorial for: "))
      valid = True
      if x < 0:
      print("Factorial is a quantity only defined for all integers greater than or equal to 0")
      factorial()
      except ValueError:
      print("Invalid input, please use an integer.")
      for i in range(1, x+1):
      j = j*i
      print (j)
      factorial()

  • @amar2039
    @amar2039 8 วันที่ผ่านมา

    I made a shorter code
    def fact (x):
    F = 1
    For i in range ( 1, x+1):
    f = f * i
    Print (f)
    fact(5)

  • @mitchellfolbe8729
    @mitchellfolbe8729 2 ปีที่แล้ว +1

    You say 'into', I say 'times'. Enjoying the series. Thanks.

  • @ruwanink
    @ruwanink 9 หลายเดือนก่อน

    Hi, I tried this way before watching your video. i'm new to Python.
    ## print value of 5! 5*4*3*2*1
    from array import *
    n= int(input("enter value to generate factorial value: "))
    arr = array('i',[])
    fact= 0
    result = 1
    i=0
    j=0
    for i in range(n):
    arr.append(i+1)

    while j < len(arr):
    result = result* arr[j]
    j+=1
    print(result)

  • @jainilkothari1171
    @jainilkothari1171 3 หลายเดือนก่อน

    b=1
    for i in range(5):
    a=i+1
    c=a*b
    b=c
    print(c)

  • @AlankritIndia
    @AlankritIndia 4 ปีที่แล้ว

    factorial using while loop
    def fac(n):
    f=1
    i=1
    while(i

  • @seyitlibaymuhammedov6376
    @seyitlibaymuhammedov6376 2 หลายเดือนก่อน

    def factorial(number):
    counter = 1
    result = 1
    while number > counter:
    counter+=1
    result = result*counter
    return result
    print(factorial(int(input("Please enter the number: "))))

  • @shanmugapriya9142
    @shanmugapriya9142 2 ปีที่แล้ว

    2nd assignment answer
    def fib(n):
    if(n

  • @tattiparry
    @tattiparry 2 ปีที่แล้ว +1

    This is how I do it:
    import math
    n = int(input("Enter a number: "))
    print("Factorial of", n, "is ", math.factorial(n)".")

  • @serhiipeka3832
    @serhiipeka3832 ปีที่แล้ว

    Another way:
    def func(x):
    if x==1:
    return 1
    else:
    return x * func(x-1)
    print(func(5))

  • @ritamsantra2372
    @ritamsantra2372 2 ปีที่แล้ว +3

    n=int(input("enter the range"))
    N1=1
    For I in range(1, n+1)
    N1=N1*i
    Print(N1)
    I think it's the easiest process

  • @noortusharkhan5034
    @noortusharkhan5034 4 ปีที่แล้ว +1

    Best Explanation and Teaching Method. Simply Awesome!!

  • @sharabugnanesh3098
    @sharabugnanesh3098 2 ปีที่แล้ว

    n=int(input("enter the no. :"))
    res=1
    while n>0:
    res*=n
    n-=1
    print(res)

  • @sharupandbarsha
    @sharupandbarsha 4 ปีที่แล้ว +1

    The factorial of 0 is also 1 which means we have to use if statement too

  • @yashmundankar24
    @yashmundankar24 4 ปีที่แล้ว

    def fact(n):
    f=1
    for i in range(1,n+1):
    f=f*i
    print(f)
    n=int(input("Enter the number you want"))
    fact(n)

  • @nicholasalexanderhenry1411
    @nicholasalexanderhenry1411 3 ปีที่แล้ว

    def fact(n):
    total = 1
    for i in range(1, n+1):
    total *= i
    print('Current Number is :', i, 'Total is = ', total)
    fact(5)

  • @prateekrathore190
    @prateekrathore190 3 ปีที่แล้ว

    QUESTION 2
    def fib(n):
    lst=[]
    k=0
    l=1
    x=0
    lst.append(k)
    lst.append(l)
    while xn:
    break
    lst.append(x)
    k=l
    l=x
    print(lst)
    n=int(input("enter the maximum limit"))
    fib(n)

  • @_a.j_a.y
    @_a.j_a.y 2 ปีที่แล้ว +1

    def fac(n):
    a=[ ]
    for i in range(1,n+1):
    a.append(i)
    import numpy
    c=numpy.prod(a)
    Print (c)

  • @sharabugnanesh3098
    @sharabugnanesh3098 2 ปีที่แล้ว

    def fact(n):
    res=1
    for i in range(n,1,-1): # in reverse order
    res*=i
    return res
    n=int(input("enter the range : "))
    res=fact(n)
    print(res)

  • @amutharajkumar657
    @amutharajkumar657 4 หลายเดือนก่อน

    j=1
    def factorial(n):
    global j
    for i in range(1,n+1):
    f = i * j
    j=f
    print(f)
    factorial(5)

  • @gauravchandel8188
    @gauravchandel8188 4 ปีที่แล้ว +3

    In case of recursion:
    x = int(input())
    def factorial(n):
    if n

  • @mahammadsayeed3972
    @mahammadsayeed3972 4 ปีที่แล้ว

    def fact(n):
    x=n
    for i in range(1,n):
    n=n+(x-i)
    print(n)
    n=int(input("enter the number"))
    fact(n)

  • @akilakavinda172
    @akilakavinda172 2 ปีที่แล้ว +1

    Alternative Code using while loop
    num =int(input("Enter the number:"))
    factorial = 1
    while num>1:
    factorial =factorial*num
    num =num-1
    print(factorial)

    • @Raja_Bilal
      @Raja_Bilal ปีที่แล้ว

      I think in place of 1
      We replace 0 is the best choice.

    • @Raja_Bilal
      @Raja_Bilal ปีที่แล้ว

      In condition

  • @prateekrathore190
    @prateekrathore190 3 ปีที่แล้ว

    factorial
    def fact(n):
    a=1
    x=1
    for i in range (n):
    x=x*a
    a+=1
    print(x)
    fact(10)

  • @anilrautela5260
    @anilrautela5260 2 ปีที่แล้ว

    def factorial(no):
    fact = 1
    for i in range(no):
    fact = fact * (i + 1)
    return fact
    no = 3
    result = factorial(no)
    print(result)

  • @vinaykawre2407
    @vinaykawre2407 2 ปีที่แล้ว

    Step by step pure technical description.

  • @ravikrishna6847
    @ravikrishna6847 4 ปีที่แล้ว

    buy adding if c

  • @Gdstyjhfrtu
    @Gdstyjhfrtu หลายเดือนก่อน

    see
    def factorial(n):
    s=1
    while n>0:
    s*=n
    n-=1
    print(s)

  • @user-no3lh7ic4e
    @user-no3lh7ic4e 3 หลายเดือนก่อน

    def fact(n):

    y=1
    for i in range(1,n+1):
    y=y*i


    print(y)
    fact(5)

  • @mr.KrishnaTalks.
    @mr.KrishnaTalks. ปีที่แล้ว

    def multiply (n):
    if n

  • @khushalthelittleartist
    @khushalthelittleartist 3 ปีที่แล้ว

    alien one is better than the experimental 'welcome theme' you used in the previous video. 'Welcome back aliens' fills our heart with happiness and a desire to do something great.

  • @afridishaik9472
    @afridishaik9472 4 ปีที่แล้ว

    in 2nd case the f value "1"remains only naa , f = f * i = 1*1=1
    f stores 1 only naa then
    f= f*i = 1*2 = 2
    i= 2, f=1 next,
    f stores 2,
    f= f*i= 2*2=4
    f stores 4 then,
    f= f*i= 6*4=24 4! = 24

  • @Laith.Alkhazragy
    @Laith.Alkhazragy 4 ปีที่แล้ว

    ef fact(n):
    x = n
    r = 1
    while x >= 1:
    r*=x
    x-=1
    print('the result is {}'.format(r))
    f = int(input('please input the value of your nummber to accont the factorial'))
    fact(f)

  • @MdRizwan-uu9dv
    @MdRizwan-uu9dv 3 ปีที่แล้ว

    n=int(input("Enter a number"))
    def fact(n):
    abtakkaprod=1
    for i in range(1,n+1):
    abtakkaprod=abtakkaprod*i
    print("Factorial=",abtakkaprod)
    fact(n)

  • @hendroheng9336
    @hendroheng9336 ปีที่แล้ว

    Why do I get 1 after performing as below?
    def fact(n):
    f=1
    for i in range(1,n+1):
    f=f*1
    return f
    x = 4
    result = fact(x)
    print(result)

  • @hozaifashakeel7758
    @hozaifashakeel7758 4 ปีที่แล้ว +1

    my code for finding factorial->
    a=int(input("enter the number:"))
    def fac(a):
    b = 1
    for i in range(1,a+1):
    b=b*i
    print(b)
    fac(a)

  • @kishoredevarakonda1819
    @kishoredevarakonda1819 3 ปีที่แล้ว +1

    sir,how can we move step by step while using debug option

  • @sauronawdi8999
    @sauronawdi8999 2 ปีที่แล้ว

    def fac(n):
    if n==1 or n==0:
    return 1
    else:
    return n*fac(n-1)
    print("{}! = {}".format(5,fac(5)))

  • @tusharkantidebnath2316
    @tusharkantidebnath2316 3 ปีที่แล้ว

    def factorial(n):
    for i in range(n,2,-1):
    a =i-1
    n= n*a
    return n
    print(factorial(5))

  • @financeliterate5179
    @financeliterate5179 5 ปีที่แล้ว +2

    Simple Way:
    fact = int(input("enter the number "))
    num = 1;
    for i in range(1, fact+1):
    num = num * i;
    print(num)

  • @MacroNinja
    @MacroNinja 2 ปีที่แล้ว

    def fib(n):
    if n < 0:
    print("Must be a number above zero! ")

    a = 0
    b = 1

    if n == 1:
    print(a)

    elif n > 1:
    print(a)
    print(b)

    for i in range(2,n):
    c = a + b
    a = b
    b = c
    print(c)
    fib(-2)

  • @thebreakoutchaser
    @thebreakoutchaser 4 ปีที่แล้ว

    def fact(num):
    a=1;
    for i in range(1,num+1):
    a=a*i
    return a
    num=int(input("enter the number"))
    a=fact(num)
    print(a)

  • @cixtianrush2631
    @cixtianrush2631 ปีที่แล้ว

    def fib(n):
    a = 0
    b = 1
    if n 100:
    print('This function\'s result set can only handle fibonacci numbers up to {}'.format(c))
    break;

  • @Maxmikemusic
    @Maxmikemusic 3 ปีที่แล้ว

    you can also do :
    def factorial(n):
    if n == 0:
    return 1
    else:
    recurse = factorial(n-1)
    result = n * recurse
    return result

  • @pheart6
    @pheart6 4 ปีที่แล้ว +1

    # if you want to print this pattern: "5 = 5 x 4 x 3 x 2 x 1"
    def fac(n):
    f = 1
    for i in range(1, n + 1):
    f = f * i
    for j in range(n, 0, -1):
    if j != 1:
    print(j, "x ", end="")
    else:
    print(j, end="")
    print(" =", f)
    data = int(input("Enter the number: "))
    fac(data)

  • @hemantkumar-sv7wn
    @hemantkumar-sv7wn 5 ปีที่แล้ว

    def fact(f):
    if f>=0:
    n=1
    for i in range(f):
    n=(f-i)*n
    print(n)
    else:
    print("Enter a positive number")
    f=int(input("Enter the number for which to find factorial: "))
    print("The factorial of the number is: ")
    fact(f)

  • @FactsDiscoveryyoutube
    @FactsDiscoveryyoutube 5 ปีที่แล้ว

    number = int(input("Enter the Number"))
    factorial = 1
    if number

  • @suhailahmed7706
    @suhailahmed7706 3 ปีที่แล้ว

    def fact(n):
    f=1
    while n!=1:
    f=f*n
    n-=1
    return f
    n=int(input("enter the last value"))
    result=fact(n)
    print(result)

  • @abd2re
    @abd2re 4 ปีที่แล้ว

    def fact(num):
    x = num-1
    for i in range(1,num):
    num *= x
    x -= 1
    return num
    print(fact(4))

  • @meghanagotike1385
    @meghanagotike1385 4 ปีที่แล้ว

    def fac(n):
    for i in range(1,n):
    n=i*n
    print(n)
    fac(4)

  • @kartiiks_world
    @kartiiks_world 4 ปีที่แล้ว

    Thank you very much Sir. After watching your videos I have not any confusion

  • @OasisFinder
    @OasisFinder 3 ปีที่แล้ว

    Factorial :
    i = 1
    first = 1
    second = 1
    user_value = int(input("please enter value"))
    while i

  • @manojkumarsingh4817
    @manojkumarsingh4817 6 ปีที่แล้ว +2

    really you explain very organised manner sir .plz make videos on advanced python

  • @angelo90th
    @angelo90th 4 ปีที่แล้ว +2

    from math import *
    x = int(input("Factorial of this number"))
    k = factorial(x)
    print("the factorial of {} is {}".format(x, k))
    def fattoriale(n):
    p = n
    if n == 0:
    return 1
    else:
    for i in range(1, n):
    p *= i
    return p
    print("the factorial of {} is {}".format(x, fattoriale(x)))

  • @BadalKumar-tu2wg
    @BadalKumar-tu2wg 2 ปีที่แล้ว

    Very good video sir Thanks

  • @_sauravnarang
    @_sauravnarang 4 ปีที่แล้ว

    def factorial(a):
    for i in range(1,a):
    a = a*i
    print(a)
    factorial(10)

  • @tempmail5655
    @tempmail5655 4 ปีที่แล้ว

    this works as same for me:
    n = int(input('Enter the number: '))
    x = n
    for i in range(1, n):
    n = i*n
    print(x, 'factorial is :', n)

  • @friendlycreeper1045
    @friendlycreeper1045 3 ปีที่แล้ว

    factorial without loop:
    def factorial(n):
    if n == 0:
    return 1
    else:
    return n * factorial(n-1)

  • @nayananr2821
    @nayananr2821 4 ปีที่แล้ว

    tried like this
    def fact(n):
    result=1
    while n>=1:
    result*=n
    n-=1
    return result
    a= int(input("enter a positive number: "))
    result= fact(a)
    print("factorial of given number is: ", result)

  • @ShajahanSmart
    @ShajahanSmart 4 ปีที่แล้ว

    n=int(input("enter "))
    k=1
    for i in range(n):
    k=k*n
    n-=1
    print(k)

  • @JKTech145
    @JKTech145 4 ปีที่แล้ว +1

    The Best Teacher Award Goes To Sir Navin

  • @vakhariyajay2224
    @vakhariyajay2224 2 ปีที่แล้ว

    Thank you very much. You are a genius.

  • @lucifer8050
    @lucifer8050 5 ปีที่แล้ว +22

    Where are you man?? The brain of computer aren't you??

  • @aayushsharma4447
    @aayushsharma4447 4 ปีที่แล้ว

    def tino(n):

    f=1

    for i in 5,2,3,4:
    f=f*i

    return f

    x=5
    result=tino(x)
    print(result)
    Y this code is giving an output value of 5 ?

  • @saharayub4448
    @saharayub4448 2 ปีที่แล้ว

    best explanation .... God bless you ....

  • @Alberta_Farmer
    @Alberta_Farmer ปีที่แล้ว

    AGH almost half way through this playlist!

  • @rahulp1785
    @rahulp1785 3 ปีที่แล้ว

    n,p = int(input("Enter any number :")),1
    for i in range(1,n+1):
    p *= i
    print("{}! = {}".format(n,p))

  • @joannareggiepasa4442
    @joannareggiepasa4442 5 ปีที่แล้ว

    def fact(x):
    f=1
    for i in range(1,x+1):
    f=f*i
    return f
    result = fact(5)
    print(result)

  • @b.sasikumar2141
    @b.sasikumar2141 4 ปีที่แล้ว

    I'm little bit miserable sir bcz I did some errors in coding anything errors means coding right so no problem I practice more examples tq sir for giving such a life platform......👌👌🙏🙏

  • @ikuyinminusolomon3934
    @ikuyinminusolomon3934 3 ปีที่แล้ว

    n=int(input('enter the number'))
    def fact(n):
    l=1
    for i in range(1,n+1):
    l=l*i
    return l
    result=fact(n)
    print(result)

  • @kumarkrish1073
    @kumarkrish1073 5 ปีที่แล้ว +4

    By this we can't find 0! It will give 0 but real ans is one

    • @siddharth0077
      @siddharth0077 5 ปีที่แล้ว

      For this u need to add one base condition as such other languages

  • @mohamedmellouky8498
    @mohamedmellouky8498 4 ปีที่แล้ว

    def fact(n):

    x=1
    for i in range(1,n+1):
    #x = i*(i+1)
    x=x*i
    print(x)
    v_from_user = int(input("Enter an integer number: "))
    fact(v_from_user)
    # Solved

  • @PreetiSingh_1106
    @PreetiSingh_1106 2 ปีที่แล้ว

    amazing videos.. thank you sir

  • @yashsharma3702
    @yashsharma3702 4 ปีที่แล้ว

    x=0
    n=int(input("Enter the number whose fact you want to find"))
    for i in range(n,1,-1):
    if(i==n):
    x=n
    else:
    n=n*i
    print("Factorial is...")
    print(n)
    quit()
    Tried something different....

  • @prasunmondal4572
    @prasunmondal4572 5 ปีที่แล้ว +9

    Alternative Code::::
    def fact(n):
    x=1
    if n==0:
    return 1
    else:
    for i in range(n):
    x=x*(i+1)
    return x
    print("Enter the number to calculate factorial: ",end=" ")
    n=int(input())
    value= fact(n)
    print("The value is:", value)

  • @tommilaaperi9687
    @tommilaaperi9687 2 ปีที่แล้ว

    Thanks for explaining this.

  • @006hariprasathg8
    @006hariprasathg8 3 ปีที่แล้ว

    Sir ur teaching is awesome but little bit decrease the speed of teaching

  • @abhishektripathi6434
    @abhishektripathi6434 4 ปีที่แล้ว

    Man, best python series.

  • @exuberantyouth8765
    @exuberantyouth8765 ปีที่แล้ว

    Awesome 👍

  • @ritikadubey3798
    @ritikadubey3798 5 ปีที่แล้ว +1

    U r an amazing person ... i like the way u say B-Bye😊.... May God Always bless u for ur effort ur bringing in students life 🙏😇

  • @harshitshreshthi4495
    @harshitshreshthi4495 6 ปีที่แล้ว

    # recursion
    def factorial(x):
    if x==0:
    return
    else:
    n = x*factorial(x-1)
    return(n)
    x = int(input("Enter a Number"))
    f = factorial(x)
    print(f)

  • @hassnainabbas595
    @hassnainabbas595 ปีที่แล้ว

    Alternative code: easy to understand:
    def fact(n):
    f=1
    for i in range(1, n+1):
    f=f*i
    print(f)
    fact(int(input('Enter the value to find factorial: ')))