Python Tutorials - Program To Find out the GCD of Two Positive Numbers

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 219

  • @smestartup8561
    @smestartup8561 4 года назад +7

    Thanks you for your clear step-by-step explanation on Euclidean algorithm using small case, 64 & 48. I could understand "why 'a' should be returned " clearly and the recursive function a little bit more. I have subscribed!!
    I hope you and your beloved ones staying healthy and happy.

    • @AmulsAcademy
      @AmulsAcademy  4 года назад +1

      Thank you so much :)
      Stay happy Stay Healthy :)

  • @kwekoweprince5077
    @kwekoweprince5077 5 лет назад +37

    You are AMAZING!!! You explained it perfectly!!!!! I subscribed

    • @AmulsAcademy
      @AmulsAcademy  5 лет назад +2

      Thank you :)

    • @mamagrace6208
      @mamagrace6208 3 года назад

      subscribed as well.

    • @debojitmandal8670
      @debojitmandal8670 3 года назад

      @@AmulsAcademy mam I don't understand the explanation bcs when you used return why only a is getting printed i.e only if condition is getting printed and not the else condition

    • @rorydaines3176
      @rorydaines3176 3 года назад

      @@AmulsAcademy You are seriously amazing, thank you for this.

  • @kacpermokrzycki2144
    @kacpermokrzycki2144 3 года назад +7

    as a curiosity you can also write
    def GCD(a,b):
    return a if b==0 else GCD(b,a%b)
    if anyone is obsessed with shortcode :))

  • @infinitygaming7192
    @infinitygaming7192 3 года назад +7

    Easy method
    Def(num1,num2)
    Lis = []
    For i in range (1,num1):
    If num1 % i ==0 and num2 % i ==0:
    Lis.append(i)
    Return lis[-1]

  • @kellymirandalobo9353
    @kellymirandalobo9353 2 года назад +6

    i really like the way you explain coding!! so clear and to the point! really thanks for the vid!

  • @thetech685
    @thetech685 3 года назад +3

    very good videos. i am a beginner coder and your tutorials really helped me out!!

  • @jaguargaming1410
    @jaguargaming1410 Год назад

    I understood it very well, every step was explained in detailed manner .

  • @tlbb1216
    @tlbb1216 5 лет назад +7

    Your channel is fantastic! There's no word to describe my gratitude to you

  • @gonitbuzz
    @gonitbuzz 3 года назад +1

    Amazing tutorial.
    Take love from Bangladesh 🇧🇩

  • @KamalSanjay-
    @KamalSanjay- 3 года назад

    There is no words to describe ur explanation, u r excellent sister☺️

  • @subhashpurushothaman3831
    @subhashpurushothaman3831 5 лет назад +8

    Wow...what's that...Your voice is so cute...Of course you explained it perfectly...your voice added more flavor to your explanation skill.......

  • @p.lakshmisairam7220
    @p.lakshmisairam7220 2 года назад

    ur explanation before writing code is awesome ....is there any paid course of yours i would like to join ...thank you madam

  • @balambhavanisankar1924
    @balambhavanisankar1924 4 года назад +2

    I just addicted to ur voice

  • @SubhaShini-zd2wt
    @SubhaShini-zd2wt 11 месяцев назад

    Guys a simple program which you can try for GCD
    a=int(input ("enter greater no"))
    b=int(input ("enter smaller no"))
    while r>0:
    r=a%b
    a=b
    b=r
    print (a)

  • @TheMasterswordish
    @TheMasterswordish 4 года назад +2

    Thanks Amul, this helped me enormously.

  • @TheDominock
    @TheDominock 4 года назад +1

    I had a terrible stop at this point. Thank you very much.

  • @jathebest2835
    @jathebest2835 Год назад

    That was a great explanation..👏 Thank you from Korea!

  • @NeerajSingh-hu9ut
    @NeerajSingh-hu9ut 3 года назад +1

    Thanks for the simple and pre-concept explanation. Thanks again !

  • @adityan5302
    @adityan5302 3 года назад

    Hat's-Off Ma'am, Amazing!! Will remember for life time

  • @pavithraraji7175
    @pavithraraji7175 3 года назад +1

    The way you explained is awesome 🤩🙌

  • @ArunKumar-il7hv
    @ArunKumar-il7hv Год назад

    Thanks mam your explanation was top notch

  • @abductingfear1098
    @abductingfear1098 3 года назад +5

    Wow that was me who completed 1k likes on this video
    Btw you deserve much more than that. Really loved it ❤

  • @unknownguywholovespizza
    @unknownguywholovespizza 2 года назад

    The easiest method is to divide the greatest number by the second one and then divide the greatest number by numerator of the result.
    Don't ask me how but it actually works and so efficient 😀

  • @niloyrahman3344
    @niloyrahman3344 3 года назад +1

    great...greater...greatest....programmer...I have ever seen ..take love from me.

  • @anthonyfes
    @anthonyfes 3 года назад +1

    Great explanation Mam!

  • @kanishkakaushik1868
    @kanishkakaushik1868 3 года назад +1

    Thanks amulya .

  • @gokceozkonuk9300
    @gokceozkonuk9300 3 года назад +2

    Thank you very much again for your detailed explaination!

  • @happydudhe383
    @happydudhe383 3 года назад

    It is a best channel to learn python 🥰

  • @pectenmaximus231
    @pectenmaximus231 4 года назад +1

    Absolutely amazing explanation. So clear. Thanks very much.

  • @saurabhsinghdhami1166
    @saurabhsinghdhami1166 5 лет назад +5

    Amazing explanation!!!! And beautiful voice:)

  • @digiviewacademy6389
    @digiviewacademy6389 3 года назад

    Graet Video.very simple and clear expanation thank you very much

  • @singisbling2500
    @singisbling2500 4 года назад +5

    Great😊 explanation
    ❤ for your lovely voice 🤗🙏

  • @marutikalyan6366
    @marutikalyan6366 3 года назад +1

    Perfect explanation I subscribed ❤️

  • @bikramjitmondal8239
    @bikramjitmondal8239 4 года назад +1

    You got a new subscriber.
    Great explanation

  • @ambadaschankhore2714
    @ambadaschankhore2714 4 года назад +2

    it's fantastic way to define exact mean of math & Programming concepts ....Really Good for your knowledge & teaching terms.

  • @jyoti3427
    @jyoti3427 2 года назад

    Mam thankyou so much for your nice explanation 🙏

  • @C.J.JOSEPH
    @C.J.JOSEPH 5 лет назад +2

    Ur video contained so much explanation thank u 😘💕

  • @latestupdates6836
    @latestupdates6836 2 года назад

    super explained in very simpleway

  • @hashikooshing7411
    @hashikooshing7411 4 года назад +1

    simply amazing individual.....

  • @SumitKumar-ti4yf
    @SumitKumar-ti4yf 5 лет назад +2

    Why it is not necessary to mention a>b....How a%b works in this program even when a

    • @AmulsAcademy
      @AmulsAcademy  5 лет назад +3

      when i take a= 4
      b = 18
      then here we can see a here we can see value is interchanged. first value becomes 18 and second value becomes 4, then it will execute the function.
      so no need to check whether a is greater then b or not
      :)

  • @zeeshanhussain7213
    @zeeshanhussain7213 4 года назад +1

    Ma'am, You're awesome, Thanks for the video...

  • @mamagrace6208
    @mamagrace6208 3 года назад +1

    Thanks for explaining it so cleary

  • @HieuNguyen-zj5so
    @HieuNguyen-zj5so 4 года назад +1

    Great explain ... Thank you so much

  • @moments_with_frds
    @moments_with_frds 2 года назад

    Good explanation 👍👍

  • @saqulainkhan6717
    @saqulainkhan6717 3 года назад +1

    Really great.Thank you🙏🙏

  • @AarthifTechBuild
    @AarthifTechBuild 6 лет назад +1

    Hello Amulus,Thank You for the video you did on GCD I will always recommend you to my friend for your wonderful teaching
    And amulus just a small request apart from the GCD programme you did can u also do a video on Conversion from Hexadecimal to decimal it's a bottom hearted request pls do it for me

  • @vinuk540
    @vinuk540 4 года назад +1

    nice and clear explanation,thank you

  • @csathishsagar516
    @csathishsagar516 Год назад

    Sister mi voice tone👌 and good explanation

  • @satyamsinha1559
    @satyamsinha1559 3 года назад +1

    Uff.. tmhara voice ♥️👌 ..nice explanation though.. very helpful

  • @mdfarhan0203
    @mdfarhan0203 3 года назад

    def gcd_function(a,b):
    big=max(a,b)
    small=min(a,b)
    # print(big)
    # print(small)
    reminder=big%small
    while reminder!=0:
    big=small
    small=reminder
    reminder=big%small
    print(small)
    number=10
    number1=20
    print(gcd_function(number,number1))

  • @Akash-lp1kc
    @Akash-lp1kc 5 лет назад +2

    Nice work..

  • @suryaeagle5516
    @suryaeagle5516 4 года назад

    Tq sister excellent explain but I need one program thats are Pascale coding plzz put it....

  • @ramkuncha3380
    @ramkuncha3380 6 лет назад +1

    if I take 3 values . it will execute or not.your explanation is super. sister I will give input in string and I want output into numbers .you will execute this programme

    • @pradeepchauhan9184
      @pradeepchauhan9184 6 лет назад +1

      Good teaching....

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад +2

      for three values you need to use reduce,
      import functools
      def gcd(a,b):
      if(b==0):
      return a
      else:
      return gcd(b,a%b)
      a=int(input("Enter first number:"))
      b=int(input("Enter second number:"))
      c=int(input(":"))
      GCD=functools.reduce(gcd,(a,b,c))
      print("GCD is: ")
      print(GCD)
      :)

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      Thank you:)

  • @SatendraYadav-cs1yh
    @SatendraYadav-cs1yh 4 года назад +1

    Excellent explain

  • @haritika96
    @haritika96 6 лет назад +1

    Ma'am mine method for calculating GCD/HCF is correct or not ?
    Num1 = int(input("Enter the first number : "))
    Num2 = int(input("Enter the second number : "))
    factors = []
    for fact in range(Num1,0,-1):
    if Num1 % fact == 0 and Num2 % fact == 0:
    factors.append(fact)
    print("HCF of ",Num1,"and",Num2,"is : {}".format(max(factors)))

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      Yes it will work :)
      But you didn't check for the smallest input,.
      when you enter the first value as bigger value, for loop will execute more times than required .
      The H.C.F can only be less than or equal to the smallest number, so no need to check till bigger number.
      :)

  • @praneethaluru2601
    @praneethaluru2601 5 лет назад

    list1=[]
    list2=[]
    for i in range(2,n1):
    if n1%i==0:
    print(i, end=',')
    list1.append(i)
    print("
    ")
    for j in range(2,n2):
    if n2%j==0:
    print(j, end=',')
    list2.append(j)
    list3=[]
    for i in list1:
    for j in list2:
    if i==j:
    list3.append(i)

    print("HCF is",max(list3))
    Is this ok?

  • @streetnoober4011
    @streetnoober4011 11 месяцев назад

    Crystal clear....🔮

  • @deadpool4422
    @deadpool4422 3 года назад

    Ma'am when i wrote
    >>> math.gcd(64,48) , you tell it will come 16 but in mines it is 1, can you tell the problem???

  • @infinitygaming7192
    @infinitygaming7192 3 года назад

    I have a easy method we can do like this we put statemnt if num1%i ==0 and num2%i ==0
    Then we will set range to (0,smallernum)
    And add this to a new list and last number will always be largest number so we will return lis[-1]

  • @vijayjakune7409
    @vijayjakune7409 3 года назад +1

    NICE VOICE
    GREAT EXPLAINATION
    KEEP IT UP :)

  • @vikashvinod3936
    @vikashvinod3936 3 года назад

    Mam , how did it run multiple times in function call?

  • @KandhaMaaran-10
    @KandhaMaaran-10 3 года назад +1

    Thankyou so much mam.......

  • @dharshinimagesh9591
    @dharshinimagesh9591 5 лет назад +1

    mam ,pl explain this
    hi mam , i understand this program but according to the if "loop"
    it should get the values
    " 2,3 or 4" as GCD coz it divides 48,36 equally how it gets 12 as GCD .
    n1 = 48
    n2 = 36
    #find smaller
    if(n1>n2):
    smaller = n2
    else:
    smaller = n1
    #getting hcf
    i = 1
    while(i

    • @AmulsAcademy
      @AmulsAcademy  5 лет назад +1

      greatest common divisor of 48 and 36 is 12.
      common divisor of 48 and 36 is 1 2 3 4 6 12
      In this greatest is 12 so GCD is 12.
      In the program while loop will run until i

    • @dharshinimagesh9591
      @dharshinimagesh9591 5 лет назад

      @@AmulsAcademy oh ok . i got it now 😃. thank u very much mam .

  • @sahukarisidhivinayaka2093
    @sahukarisidhivinayaka2093 3 года назад

    Mam in first case i.e 4%18 you got 4. Can you please explain how did you get that?

  • @charangummadi6863
    @charangummadi6863 3 года назад +1

    ❤️👍👍 well explanation

  • @komaljaswani7497
    @komaljaswani7497 5 лет назад

    Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(

  • @somyachawla5422
    @somyachawla5422 3 года назад +1

    What if we remove return statement from ComputeGCD

  • @reshmik4619
    @reshmik4619 3 года назад +1

    Thank you so much mam🤗😁

  • @MDSHAHABUDDIN-ep4rc
    @MDSHAHABUDDIN-ep4rc 3 года назад +1

    Thanks a lot mam!!

  • @manoj7207
    @manoj7207 3 года назад +1

    Thankyou so much

  • @sajankumar-ly1tm
    @sajankumar-ly1tm 5 лет назад +1

    you are explain perfect ...!!!!!!

  • @veeraregalla2460
    @veeraregalla2460 4 года назад

    Explain how to read values seperated by comma

  • @fardoushemal2622
    @fardoushemal2622 4 года назад +1

    I need your video about LCM

  • @hiteshchaudhari8698
    @hiteshchaudhari8698 3 года назад +1

    You are awesome mam

  • @hrithikaraju
    @hrithikaraju 4 года назад +1

    Great, thanks😇

  • @kskbasha551
    @kskbasha551 2 года назад

    Greatest common divisor in the sense greatest common factor right ?

  • @astrovishwalingam7299
    @astrovishwalingam7299 4 года назад +2

    Your voice is so cute thanks for you

  • @HarshitaChattopadhyay
    @HarshitaChattopadhyay 4 года назад +1

    Mam can u pls do LCM of 2 numbers programs pls...

  • @jd9452
    @jd9452 4 года назад

    WOW, you are so good, Thank You so much for your help.

  • @gangabhavanisayana8600
    @gangabhavanisayana8600 2 года назад

    Output showing ComputeGCd not defined

  • @thuantranvan3164
    @thuantranvan3164 4 года назад

    If a and b are complex numbers, how can I find gcd. Please help me

  • @pradumnyarokade9935
    @pradumnyarokade9935 5 лет назад +2

    Ma'am how 2 find
    Gcd of big no.
    As like
    3997 & 2947

    • @AmulsAcademy
      @AmulsAcademy  5 лет назад

      I think you are asking manually how to find out the gcd of bigger numbers.
      There are some mathematical shortcuts you need search that, you can google it.
      :)

  • @juliannafotheringham7101
    @juliannafotheringham7101 3 года назад +1

    I love you thank you

  • @264bakshay9
    @264bakshay9 3 года назад +1

    Challa bagundhi

  • @jaseerhussain2977
    @jaseerhussain2977 3 года назад +1

    good mam and example more porgramm

  • @sasidharnaidu4507
    @sasidharnaidu4507 Год назад

    Well, you could have checked for the reminder, then return b. Anyway, only one step will be reduced

  • @manikandand2541
    @manikandand2541 4 года назад +1

    mam do u have any udemy course ....if soo plz share the link.....

  • @davlatbekkobiljonov911
    @davlatbekkobiljonov911 2 года назад

    Thank you!!

  • @roddaganesh1729
    @roddaganesh1729 3 года назад

    def gcd(n,m):
    if m==0:
    return n
    elif n==0:
    return m
    else:
    return(gcd(m,n%m))
    n=int(input())
    m=int(input())
    k=gcd(n,m)
    print(k)
    i think this is the correct code

  • @linkmageful
    @linkmageful 6 лет назад +1

    is this the recursive form?

  • @shotokproductions9162
    @shotokproductions9162 6 лет назад

    Hi Amulya how to develop logics like this and did each program logic needs base and recursive cases

    • @linkmageful
      @linkmageful 6 лет назад +1

      is that the recursive code?

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад

      No you can write program without recursion also(iterative approach).
      But for some problems using recursion is best choice because of its simplicity.
      There are many articles on "how to think recursively in python". You can refer that.
      :)

    • @AmulsAcademy
      @AmulsAcademy  6 лет назад +1

      Yes:)
      @linkmageful

    • @shotokproductions9162
      @shotokproductions9162 6 лет назад

      will it possible to have all your code in mail?

  • @C.J.JOSEPH
    @C.J.JOSEPH 5 лет назад +1

    And what is the algorithm for this gcd program, can u please tell me.

  • @collinsnwanze8502
    @collinsnwanze8502 2 года назад

    Thank you

  • @WeShallOvercome
    @WeShallOvercome 4 года назад +1

    thanks

  • @srikanthchittampally3398
    @srikanthchittampally3398 5 лет назад

    How the program runs without using loop

  • @ambujkhanduri5672
    @ambujkhanduri5672 5 лет назад

    How to make a program to find the LCM
    And how to make a program to find the second lowest numbers from given n numbers.

  • @RameshPal-cd4cs
    @RameshPal-cd4cs 4 месяца назад

    How to find LCM and HCF by python

  • @kvnagendra5354
    @kvnagendra5354 5 лет назад +2

    *I don't know ur name but tq yaar 💝💝*

  • @sahithibhimavarapu5103
    @sahithibhimavarapu5103 4 года назад

    We didn't get output for this program

  • @eswarisangeetha3730
    @eswarisangeetha3730 6 лет назад +1

    Give a detail information about merge sort sister