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

Поделиться
HTML-код
  • Опубликовано: 15 дек 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 :)

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

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

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

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

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

      Thank you :)

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

      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.

  • @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]

  • @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 :))

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

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

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

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

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

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

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

    Amazing tutorial.
    Take love from Bangladesh 🇧🇩

  • @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.......

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

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

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

    I just addicted to ur voice

  • @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 ❤

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

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

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

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

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

    Thanks Amul, this helped me enormously.

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

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

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

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

  • @SubhaShini-zd2wt
    @SubhaShini-zd2wt Год назад

    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)

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

    Great😊 explanation
    ❤ for your lovely voice 🤗🙏

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

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

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

    The way you explained is awesome 🤩🙌

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

    Amazing explanation!!!! And beautiful voice:)

  • @youarethecssformyhtml
    @youarethecssformyhtml 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 😀

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

    It is a best channel to learn python 🥰

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

    Thanks mam your explanation was top notch

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

    Absolutely amazing explanation. So clear. Thanks very much.

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

    Great explanation Mam!

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

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

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

    Thank you very much again for your detailed explaination!

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

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

  • @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

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

    You got a new subscriber.
    Great explanation

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

    Ur video contained so much explanation thank u 😘💕

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

    Perfect explanation I subscribed ❤️

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

    Sister mi voice tone👌 and good explanation

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

    Mam thankyou so much for your nice explanation 🙏

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

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

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

    Thanks amulya .

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

    Good explanation 👍👍

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

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

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

    nice and clear explanation,thank you

  • @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
      :)

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

    Really great.Thank you🙏🙏

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

    super explained in very simpleway

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

    Nice work..

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

    ❤️👍👍 well explanation

  • @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???

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

    simply amazing individual.....

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

    Crystal clear....🔮

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

    Thank you so much mam🤗😁

  • @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.
      :)

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

    Great explain ... Thank you so much

  • @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 .

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

    NICE VOICE
    GREAT EXPLAINATION
    KEEP IT UP :)

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

    Thanks for explaining it so cleary

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

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

  • @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))

  • @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

  • @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?

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

    Your voice is so cute thanks for you

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

    Excellent explain

  • @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!! :(

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

    Thankyou so much mam.......

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

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

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

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

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

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

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

    Great, thanks😇

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

    You are awesome mam

  • @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:)

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

    Thanks a lot mam!!

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

    Thankyou so much

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

    What if we remove return statement from ComputeGCD

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

    is this the recursive form?

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

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

  • @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]

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

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

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

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

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

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

  • @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.
      :)

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

    good mam and example more porgramm

  • @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?

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

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

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

    Thank you!!

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

    I need your video about LCM

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

    Thank you

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

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

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

    Super mam ❤️

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

    I love you 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

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

    Had to watch the last part a few times but damn thank you so much cause now I get it! Solving some Python Basic challenges from W3R schools and didnt really get this one...TILL NOW 😊😊🤣🤣😉😎😎

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

    thanks

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

    Challa bagundhi

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

    I need help Mam. I want the code for LCM

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

    Explain how to read values seperated by comma

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

    Give a detail information about merge sort sister

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

    subscribed..reallly u are amazing

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

    Output showing ComputeGCd not defined

  • @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.

  • @XB-Narsingh
    @XB-Narsingh 5 лет назад +1

    gd perfect thank s so much