Captain NALI

Well-known member
  • Apr 23, 2011
    2,274
    260
    83
    Kiri Matte
    matchanla EK ake innawada PYTHON software aken program liyanna

    apita mee semester ake IT subject akak tyanawa,apita nikan greek wage

    methana kawruhari programn waddo innawanm me quetion akata answr aka commnt akakin daanawada?
    loku help akak


    1)Write a python program which genarates a positive integer between 0 and 20(suppose the generated integer is "m") and calculate the product 1*2*3*4*5...............*(m-1)*m and print the value of the product

    dan natnm bump akakwat daaanna plzzzzzzzzzzz:sorry::sorry::sorry::sorry:
     

    nuni

    Member
    Feb 5, 2009
    277
    24
    0
    Colombo
    Hope this is what you want machang :)

    #Generating a random number between 0 and 20

    import random

    m=random.randrange(0,20)

    #Printing the Random Number

    print('This is my Random No -', m)
    Final = 1

    while (m>0):
    #print(m)
    Final = Final * m
    m -= 1

    print('Final Answer is: ', Final)​

    Beware of indentation :). While loop eke Athule thiyena deka indent karanna :) eka tab ekak :)
     
    Last edited:
    • Like
    Reactions: Captain NALI