Program to find HCF & LCM of two numbers in C | #6 Coding Bytes

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • In this video, we will discuss the logic to find out LCM & HCF of two given numbers in C. If you want to know the solution to calculate LCM & GCD of given numbers in C++, Java and Python then check out the below links.
    1) LCM of two numbers, LCM using GCD - bit.ly/2kM7Y4m
    2) GCD of two numbers, GCD using Recursion - bit.ly/2mfvB5C
    For more programming questions, check out this link - bit.ly/must-pra...
    Also, to receive placement preparation tips and placement related updates on TCS, Accenture and various other companies. Come join the largest community on FACE’s Telegram and WhatsApp, and take your placement preparation to the next level.
    Join here:
    Telegram: t.me/faceprepo...
    WhatsApp: bit.ly/2MgoYMR

КОМЕНТАРІ • 61

  • @krishnabhagat2716
    @krishnabhagat2716 4 роки тому +6

    Yup you have save my lots of time in single video. Thanks nice work .

    • @utkarsapilla6180
      @utkarsapilla6180 3 роки тому

      HCF 3min video lcm 3min video . Here 9 min video...3min of your precious time got wasted? Sed!

  • @hullagtpp
    @hullagtpp 3 роки тому +13

    ....How did your code compile ? int "i" is not declared... is it c Compiler only or some other compiler ?

    • @FACEPrep
      @FACEPrep  3 роки тому +1

      Yes originally i was not declared and it did throw an error, then i was initialized and compiled. Correcting the error was not shown in the video.

  • @rameshwarkurmi3504
    @rameshwarkurmi3504 5 років тому +2

    आपका पढ़ाने का तरीका बहुत ही अच्छा है बहुत ही शानदार है हमारी आपके साथ शुभ कामना है कि आप सभी की इसी तरह मदद करें और आप भी बहुत आगे जाएं

  • @rishabhgupta5460
    @rishabhgupta5460 5 років тому +10

    Please if possible then make a tutorial for pattern printing complex patterns two patterns together it will be very helpful for us .
    Thankyou

    • @FACEPrep
      @FACEPrep  5 років тому

      Hi, we will soon make videos on pattern printing. However, you can also have a look at this for practice - www.faceprep.in/pattern-programs-in-c/

  • @HomeNetwork404
    @HomeNetwork404 3 роки тому +17

    Tomorrow is my mid-sen and I'm watching this....😅😅😅

    • @sarcastic350
      @sarcastic350 8 місяців тому

      Bhai 9 bje est hai or 8.30 pe ye video dekh rha hu

  • @sukhendubhattacharjee6845
    @sukhendubhattacharjee6845 3 роки тому +3

    Extremely helpful.. thanx for this vdo

  • @harhar260
    @harhar260 2 роки тому +1

    You guys are my saving grace!!!!!THANK YOU!

  • @anilkumarkarri3978
    @anilkumarkarri3978 2 роки тому +2

    good video mam tq ...

  • @Coder_421
    @Coder_421 3 роки тому +1

    Explanation and coding is entire different

  • @raihanrony1810
    @raihanrony1810 3 роки тому +4

    aren't all N>1 numbers divisible by i=1.
    so gcd is gonna be 1 every time

    • @raveenak8581
      @raveenak8581 3 роки тому +2

      Because in this for loop, we don't use break statement. So that i=1 will iterate till the last (greatest) i value that satisfies n1%i==0 && n2%i==0.

    • @annemarydavid8620
      @annemarydavid8620 2 роки тому +1

      @@raveenak8581 Thank u🤗🥰

  • @vivek5807
    @vivek5807 2 роки тому +1

    Thank you very mych

  • @karnika216
    @karnika216 3 роки тому +2

    i is not declared and still the program got compiled,.... How?

  • @rutik42
    @rutik42 4 роки тому +2

    Hey faceprep, please upload more videos on these type of topics. I watched so many videos but This playlist is best on youtube. Need more content please.

    • @FACEPrep
      @FACEPrep  4 роки тому

      Thank You for all the love. We will upload very soon.

  • @darshan_the_admin
    @darshan_the_admin Рік тому

    Thank you so so much

  • @ESSharath
    @ESSharath 4 роки тому +1

    Wonderful logic 👍👍

  • @vandanamallareddy8470
    @vandanamallareddy8470 3 роки тому

    Nice explanation

  • @pritamparali2793
    @pritamparali2793 2 роки тому +1

    mam why are we taking minimum value among n1 and n2 ???? that thing didnot clear

  • @needtime2change706
    @needtime2change706 3 роки тому

    In that case if u take i value as 2 mean u will get the crt answer because by 1 both value will divise

  • @yamiprincess
    @yamiprincess 10 місяців тому

    That voice is amaaaazinnngggg

  • @adityakanakamalla8979
    @adityakanakamalla8979 4 роки тому +1

    lcm and gcd for array how it will be?..can u explain

  • @it_91_vaibkhare20
    @it_91_vaibkhare20 4 роки тому +4

    Your program took more time than expected.
    Expected time limit

    • @YuvrajSingh-bj2jh
      @YuvrajSingh-bj2jh 4 роки тому

      long gcd(long a,long b){
      if(a==0)
      return b;
      else
      return gcd(b%a,a);
      }
      int main() {
      //code
      int t;
      cin>>t;
      while(t--){
      long a,b;
      cin>>a>>b;
      long hcf=gcd(a,b);
      long lcm=(a*b)/hcf;
      cout

  • @aquax-50
    @aquax-50 5 місяців тому

    How to use this loop in a function

  • @rupesh6363
    @rupesh6363 5 років тому

    Thanks

  • @mahendrazode7104
    @mahendrazode7104 2 роки тому +2

    Thank you but font size is very little

    • @FACEPrep
      @FACEPrep  2 роки тому +1

      Thanks for your feedback. We'll consider it.

  • @allinne2177
    @allinne2177 3 роки тому +1

    I think everytime for every number the code will not work properly

  • @prajwalnegi22
    @prajwalnegi22 3 роки тому +1

    i understood the logic but this video was totally useless for me, because i thought youwere going to teach the code, cus I already knew the logic btw thanks anyways

  • @amirshaikh2458
    @amirshaikh2458 3 роки тому

    Can you please explain me this logic how it works for and if condition for find GCM

    • @FACEPrep
      @FACEPrep  3 роки тому +1

      Can you please elaborate on GCM

  • @sjeeva7402
    @sjeeva7402 5 років тому

    Pls make a video for printing difficult patterns..

    • @FACEPrep
      @FACEPrep  5 років тому

      Hi, we will soon make videos on pattern printing. However, you can also have a look at this for practice - www.faceprep.in/pattern-programs-in-c/

  • @VIVEKKUMAR-pe3ou
    @VIVEKKUMAR-pe3ou 4 роки тому +1

    plz can u explain gcd = i i have not understand

    • @FACEPrep
      @FACEPrep  4 роки тому +2

      If the two numbers are completely divisible by i, then gcd will become i. That is what it indicates.

    • @yeswamthlepuru3068
      @yeswamthlepuru3068 4 роки тому

      What's happens when there exists more than one number

    • @crazy_stanle
      @crazy_stanle 3 роки тому

      @@yeswamthlepuru3068 then use break

  • @sujanreddy7396
    @sujanreddy7396 3 роки тому

    Program is not getting executed

  • @anshukumaryadav6387
    @anshukumaryadav6387 3 роки тому

    madam i declear to kr digye

  • @surajnath5148
    @surajnath5148 5 років тому

    How to calculate large power e.g 200^200 in c

    • @surajnath5148
      @surajnath5148 5 років тому

      @@tejask5417 no it doesn't work.

    • @srijavalikotha7686
      @srijavalikotha7686 10 місяців тому

      @@surajnath5148 by using pow function in c and u need to include math.h heterfile also.

  • @Ashutoshchauhan1
    @Ashutoshchauhan1 Рік тому

    Ma'am hindi me bolte to aur acche se samajh me aataa 😶

  • @sonykumari121
    @sonykumari121 3 роки тому

    Saf dikhta ny hai mam

  • @bengalispiritual3687
    @bengalispiritual3687 5 років тому +1

    Isme output galat a raha hei

    • @FACEPrep
      @FACEPrep  5 років тому +1

      Hi, The output is exactly right. Kindly go through the video or let us know your question in detail.

  • @AbhishekGupta-pj7vz
    @AbhishekGupta-pj7vz 2 роки тому

    Mene video kholi because I got a little crush on her 😁🤫🤪

  • @himanshukrdiwedi4554
    @himanshukrdiwedi4554 9 місяців тому

    Not good

  • @sheygabit9641
    @sheygabit9641 2 роки тому

    I think your explanations are too fast

    • @FACEPrep
      @FACEPrep  2 роки тому +1

      Thank you for your feedback. We'll consider it.