No video

Calculate LCM Of Two Numbers in Python | Python Program For Finding LCM of 2 Numbers

  Рет қаралды 36,359

CodeWithHarry

CodeWithHarry

Күн бұрын

How to find LCM of two numbers: Today we will write a Python program to find the LCM of two numbers. This is a Python Program to find the LCM of two numbers with complete explanation. The program takes two numbers and prints the LCM of two numbers.
►Python Practice Playlist: • Python Practice Progra...
►Checkout my English channel here: / programmingwithharry
►Click here to subscribe - / @codewithharry
Best Hindi Videos For Learning Programming:
►Learn Python In One Video - • Python Tutorial In Hin...
►Python Complete Course In Hindi - • Python Tutorials For A...
►C Language Complete Course In Hindi -
• C Language Tutorials I...
►JavaScript Complete Course In Hindi -
• JavaScript Tutorials I...
►Learn JavaScript in One Video - • JavaScript Tutorial
►Learn PHP In One Video - • Learn Php In One Video...
►Django Complete Course In Hindi -
• Python Django Tutorial...
►Machine Learning Using Python - • Machine Learning Tutor...
►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
►Advanced Python Tutorials - • Intermediate/Advanced ...
►Object Oriented Programming In Python - • Object Oriented Progra...
►Python Data Science and Big Data Tutorials - • Python Data Science an...
Follow Me On Social Media
►Website (created using Flask) - www.codewithhar...
►Facebook - / codewithharry
►Instagram - / codewithharry
►Personal Facebook A/c - / geekyharis
Twitter - / haris_is_here

Пікірлер: 161
@sunilpal5389
@sunilpal5389 4 жыл бұрын
One of the best coding teacher of this era!
@BCS_MohdMaaz-bm8vu
@BCS_MohdMaaz-bm8vu 2 жыл бұрын
LCM to n numbers # LCM of n numbers n = int(input("Enter value of n : ")) li = [] print("Enter the numbers : ") for i in range(n): li.append(int(input())) def LCM(li): max = None for i in range(n): if max is None or max < li[i]: max = li[i] while True: for i in range(n): if(max % li[i] == 0): if( i == n-1): return max else: continue else: break max = max+1 LCM = LCM(li) print(f"LCM of {li} is {LCM}") Thanks Harry bhai you teach it so well that now i can easily find the lcm of n numbers
@aditgaur1585
@aditgaur1585 4 жыл бұрын
I think we can simplify our code by :- a = int(input('Enter the First number: ')) b = int(input('Enter the second number: ')) maxNum = max(a, b) while maxNum % a != 0 or maxNum % b != 0: maxNum += 1 print(f"The lcm is {maxNum}")
@jishnudhar1507
@jishnudhar1507 2 жыл бұрын
Thank you Very much!
@RinkuDevi-mu6uz
@RinkuDevi-mu6uz 2 жыл бұрын
Sir , using this code I've found out both HCF and LCM of two numbers (I've not used math module) : def hcf(a,b): if a < b: c = a + 1 else: c = b + 1 for i in range(2,c): if ((a%i == 0) and (b%i == 0)): hcf = i return hcf a = int(input('Enter 1st number : ')) b = int(input('Enter 2nd number : ')) print() print('The HCF of these two numbers is :' , hcf(a,b)) d = (a*b)/hcf(a,b) print('The LCM of these two numbers is :' , int(d)) Hope you like it .
@durgaprasadkanda1676
@durgaprasadkanda1676 2 жыл бұрын
For 3,5 what will hcf function return? It should be 1.
@satyajitdas2780
@satyajitdas2780 4 жыл бұрын
Harry Praji. Bas isika intazaar tha. Wo bhi Apne puri Kar Di. Thanks Praji . Aise hi maths and CP me video. Banayiye. Apka channel best hai. Aur aap to ho hi best. Aur all rounder. Superb explanation.
@DiptabrataMukherjee
@DiptabrataMukherjee 4 жыл бұрын
Please make a series on React JS...
@vandanajha188
@vandanajha188 4 жыл бұрын
Ha bhai hmko bhi sikhna h
@ishansrivastava674
@ishansrivastava674 4 жыл бұрын
hello sir i am currently watching your python full playlist and I am on the 36th video of that playlist and I just wanted to say thank you sir for creating such good videos
@sanjaytoge1707
@sanjaytoge1707 4 жыл бұрын
Bhaiya aap jaise teacher hona chaiye bas... India sbse aage chla jyega
@vimalkumarchaudhary1913
@vimalkumarchaudhary1913 4 жыл бұрын
Pura pasand aaya hai nd best incredible teach
@akshayshinde2403
@akshayshinde2403 4 жыл бұрын
i have watched your machine learning playlist and it helped me a lot. Thank you.
@vigneshnu3511
@vigneshnu3511 4 жыл бұрын
Harry bhai kyo na aap programming ke liye maths be sikhane🤩🔥
@adityahansa8230
@adityahansa8230 4 жыл бұрын
Congratulations sir on 6 lakh subscribers
@tasin487
@tasin487 4 жыл бұрын
Thanks a lot Harry vai. It helped me a lot.
@Lila12386
@Lila12386 4 жыл бұрын
Nice
@introvertgamer6850
@introvertgamer6850 2 жыл бұрын
hi i got this question in an interview i used same method but for large input time limit get exceeded is there any optimal way to solve it
@rajnishpal2460
@rajnishpal2460 4 жыл бұрын
One of the simpliest explanations by harry bhai
@santoshgandhi6216
@santoshgandhi6216 4 жыл бұрын
sir please make hangman game with python please.
@Adarsh-ox3dt
@Adarsh-ox3dt 4 жыл бұрын
Thank you so much sir, really you are great😊
@yash770
@yash770 4 жыл бұрын
Harry sir plz make a playlist for REACT .Sir u are doing amazing work .
@akusarma686
@akusarma686 4 жыл бұрын
Excellent video
@sparkhivemarketing
@sparkhivemarketing 4 жыл бұрын
I always like your videos
@om2455
@om2455 4 жыл бұрын
Harry you are good
@raghavsihag
@raghavsihag 4 жыл бұрын
Bhai Ruby and shwift par banao series🤗
@vihaanshah5480
@vihaanshah5480 4 жыл бұрын
Ethical hacking ka bhi tutorial banao agar appko aata hei.
@Uranus663
@Uranus663 4 жыл бұрын
Harry bhai , I wish aapke 1 million ho jaye
@hemrajyadav3429
@hemrajyadav3429 4 жыл бұрын
Harry please make full video with explaining all things on topic “ how to setup python in Microsoft visual studio code” because i am unable to do this and i really want to learn coding with you harry bro
@thatcoolkid370
@thatcoolkid370 4 жыл бұрын
He had already made a video on it
@desihiphop4998
@desihiphop4998 3 жыл бұрын
Great video
@MananGandhi
@MananGandhi 4 жыл бұрын
East or West, Harry Bhai is the best
@nilanshpathakk760
@nilanshpathakk760 2 жыл бұрын
thanks bro!
@monikavarshney5029
@monikavarshney5029 4 жыл бұрын
Hi Harry Your videos are awesome Just tell which software are you using to explain? Pls tell🙏🙏🙏👍👍👍
@monikavarshney5029
@monikavarshney5029 4 жыл бұрын
I know this comment is very low. But still pls respond
@vaibhav3852
@vaibhav3852 4 жыл бұрын
If u r talking about java than the software is intelij but if u r talking about anything else then pls reply to comment and I will tell u
@official_freefire3500
@official_freefire3500 Жыл бұрын
Vs code software h ye
@sunilsah4993
@sunilsah4993 4 жыл бұрын
a = int(input(" Enter first number ")) b = int(input(" Enter second number/n") maxNum = max( a, b ) while( True ): If( maxNum%a==0 and maxNum%b==0): Break maxNum = maxNum + 1 Print(f"The LCM of {a} and {b} is {maxNum}")
@RaviRanjan-yi5rq
@RaviRanjan-yi5rq Жыл бұрын
maxnum=maxnum+1 why
@siddiqajamadar2283
@siddiqajamadar2283 4 жыл бұрын
Please Harry bhaei reply please flutter or dart pay vedio bna do Hindi k sare vedios KZfaq k samj nhi ate buss Aap k vedios ascche say smaj ate heai to please 🙏🙏🙏🙏🙏🙏🙏
@krissrka4375
@krissrka4375 4 жыл бұрын
Thank you sir..Thank u for making Python an easy programme that I can understand..
@PremBardhan
@PremBardhan 4 жыл бұрын
Bhai kya baat Love you
@MarcosGamingMLBB
@MarcosGamingMLBB 4 жыл бұрын
Harry vai ap carry guide se related video live korte to achha hota ...and machine learning k related thore or video hote to achha hota
@ManishSharma-fi2vr
@ManishSharma-fi2vr 4 жыл бұрын
❤Love you bhai
@IjazAhmad-wv9qx
@IjazAhmad-wv9qx 20 күн бұрын
Amazing
@dejavu5616
@dejavu5616 4 жыл бұрын
1 viewer sir following ur python playlist at 51 video
@code_mode
@code_mode 4 жыл бұрын
very nice hay
@waibhavraj4588
@waibhavraj4588 4 жыл бұрын
Sir codeing karne ke liye best 💻laptop kaun sa hai
@Ali-cw3kn
@Ali-cw3kn 2 жыл бұрын
Hp yai Apple
@anokhautomation4453
@anokhautomation4453 3 жыл бұрын
Nice tutorial 👍
@sudarshanmhaisdhune1039
@sudarshanmhaisdhune1039 3 жыл бұрын
Good one!
@codewithsheri
@codewithsheri 4 жыл бұрын
Love from Pakistan I am your fan
@RohanDasRD
@RohanDasRD 4 жыл бұрын
💖 Awesome bhai 😊
@pennywise6058
@pennywise6058 3 жыл бұрын
Very useful
@focusonmyaim8980
@focusonmyaim8980 5 ай бұрын
a= int(input(“enter a no”) ) b=int(input (“enter second no”)) i=1 while ((a*i)%b !=0): i+=1 LCM= a*i; print(“LCM of” , a “and”, b , “is” , LCM)
@codewithsheri
@codewithsheri 4 жыл бұрын
I am working on Android development should I choose flutter or React-Native because these are cross plateform language to develop both iOS and Android apps.
@rudrashiva
@rudrashiva 4 жыл бұрын
Programming is the best way to increase your thinking capabilities. Let's build a strong Bharat coding force.
@blacksssharkvlogs4553
@blacksssharkvlogs4553 4 жыл бұрын
bhaiya mai bhi programming ke line pe jaunnga .
@shivanshutyagi83
@shivanshutyagi83 4 жыл бұрын
Harry bhai 👋👋
@santoshgandhi6216
@santoshgandhi6216 4 жыл бұрын
sir, please make hangman game
@evilytlive
@evilytlive Жыл бұрын
Python is too hard for me 😢😢😢😢😢
@Shauryaaaaaaaa
@Shauryaaaaaaaa 4 жыл бұрын
Java = System.out.println("Harry is the best teacher"); JavaScript = Console.log("Harry is the best teacher"); Python = print ("Harry is the best teacher") .... .... .... You take as many languages but the output will be same that Harry is the best teacher
@GeekyShubhamSharma
@GeekyShubhamSharma 4 жыл бұрын
Jab string hi same hogi to value bhi same aaegi na😂
@mohit2942
@mohit2942 4 жыл бұрын
@@GeekyShubhamSharma 🤣🤣🤣🤣🤣
@Shauryaaaaaaaa
@Shauryaaaaaaaa 4 жыл бұрын
@@GeekyShubhamSharma are yaar Maine to baas Harry Bhai ke honour me likha tha 😁😁
@Rahul_Singh_Human
@Rahul_Singh_Human 4 жыл бұрын
django rest API video harry bhai
@desikalakar3772
@desikalakar3772 4 жыл бұрын
Harry bhai aap google ki interview kyu nahi dete?
@The_WarMachine
@The_WarMachine 3 жыл бұрын
Nice 👍
@sachini1168
@sachini1168 Жыл бұрын
p=int(input("enter num1:")) j=int(input("enter num2:")) if(p>j): for k in range(1,p+1): if(p%k==0)and(j%k==0): l=k else: for o in range(1,j+1): if(p%o==0)and(j%o==0): l=o print("LCM of the following numbers is",(int((p*j)/l))) Simpler.
@PranavBhattad
@PranavBhattad 4 жыл бұрын
Harry Bhai do kivy tutorial please pls listen to your old subs, you are not listening mine from when you have got new subs...
@harnoorpanesar5056
@harnoorpanesar5056 4 жыл бұрын
2nd bro
@chaitanyabansal292
@chaitanyabansal292 2 жыл бұрын
should not we write maxnum= maxnum+ max(a,b). Since LCM will always increase in the multiples.
@ruchitashah6317
@ruchitashah6317 4 жыл бұрын
Plz make a jarvis because my brother was telling that u can not make jrlarvis by using java
@XAAbhayDarade
@XAAbhayDarade 4 жыл бұрын
Harry bhai 3d game ki series banao na
@AshishTiwari-zj7yq
@AshishTiwari-zj7yq 4 жыл бұрын
MaxNum=MaxNum+MaxNum
@apoorvagupta8413
@apoorvagupta8413 4 жыл бұрын
Please harry bhai Cv2 python tutorial
@laxmikanth8076
@laxmikanth8076 2 жыл бұрын
sir how to get out while loop without using break . for this to happen what condition should we give to while loop for the same program
@AdarshSingh-cb5yf
@AdarshSingh-cb5yf 4 жыл бұрын
Sir ji please ds and Algo ... Daily 🙏🙏
@ujjwalverma6499
@ujjwalverma6499 4 жыл бұрын
Search array ka koi program kr do harry brother
@jmpiyush5676
@jmpiyush5676 4 жыл бұрын
Harry bhai pz start node.js tutorial for android backend
@thelocaldev
@thelocaldev 4 жыл бұрын
Sir I think it is not working fine its not able to calculate the LCM of 3 and 5 , its giving a result of 5 where the original result must be 15
@Anujkumar-wt1qs
@Anujkumar-wt1qs 4 жыл бұрын
Bro please make DS videos fast
@harsh_miglani99
@harsh_miglani99 4 жыл бұрын
Sir i have a question that can i create web application with html,js and css
@rajputjay9856
@rajputjay9856 4 жыл бұрын
You will also need REACT AND NODE too
@mohitgupta2699
@mohitgupta2699 4 жыл бұрын
Yes I have make with pure html , css , js and no other libary or framework used
@harsh_miglani99
@harsh_miglani99 4 жыл бұрын
@@mohitgupta2699 thnks bro
@rajputjay9856
@rajputjay9856 4 жыл бұрын
@@mohitgupta2699 learn some frame works too... like DJANGO AND FLASK also
@mohitgupta2699
@mohitgupta2699 4 жыл бұрын
@@rajputjay9856 I am new to python
@sindhavabhishek2160
@sindhavabhishek2160 4 жыл бұрын
Please tutorial on Oracle
@AkashSharma-mv2yx
@AkashSharma-mv2yx 4 жыл бұрын
Bhai m ne ek software banaya h aap ke video dekh ker or m us ko play store per upload ker ru ga per kya m ker m update dal pau ga kya
@apoorvagupta8413
@apoorvagupta8413 4 жыл бұрын
One of the first comment Can I get heart😍😍
@shivamchaudhary2714
@shivamchaudhary2714 2 жыл бұрын
Sir more than 2 numbers ka LCM nikalne ke lia kya kare Please bata do 🙏🙏
@mafiaop9251
@mafiaop9251 4 жыл бұрын
Sir, please make video on artificial intelligence AI
@g4j3ndr4
@g4j3ndr4 4 жыл бұрын
Bhaiya class 10th se aadhe aadhe ghante me kya ham programming sikh sakte hai ??? Agar ha to hame start kya chiz se karna chahiye jo next 2-3 years me beneficial ho.....please like and comment !!!
@Shauryaaaaaaaa
@Shauryaaaaaaaa 4 жыл бұрын
I think you should start from c++
@g4j3ndr4
@g4j3ndr4 4 жыл бұрын
@@Shauryaaaaaaaa please tell liitle bit some plan or flow chart sow that o could learn one after another
@prashantthakur113
@prashantthakur113 4 жыл бұрын
Sir apney toh "python for absolute beginner" waley playlist mai toh Python key liye hammey pycharm recommend kiya tha..Toh ye (v.s code) mey kyu kar rahey Ho?
@rajputjay9856
@rajputjay9856 4 жыл бұрын
You can use VSCODE THATS BETTER .... Pycharm is complicated a little bit with libraries ... So use VSCODE that's the best
@prashantthakur113
@prashantthakur113 4 жыл бұрын
@@rajputjay9856 Okay brother
@mohitgupta2699
@mohitgupta2699 4 жыл бұрын
I use submile text 3 , it is a light weight editor and easy to install
@prashantthakur113
@prashantthakur113 4 жыл бұрын
@@mohitgupta2699 Me too
@Tigergrafjoker07
@Tigergrafjoker07 17 күн бұрын
sir, use for loop video give me
@meh0089
@meh0089 4 жыл бұрын
Please make app development using react native and mongodb
@Opinionmatrix1
@Opinionmatrix1 4 жыл бұрын
Sir plz reply me... Maine IT branch liya hai mera abhi first year mai admission kua hai.... Kaise padhu sir ki achha placement aur achhi knowledge le saku....🙏 plz reply sir aaj pehli bar apka channel dekha hu aur explore bhi kar rha hu.... Sir mere college ka naam- UCER Allahabad hai
@Prateek03
@Prateek03 4 жыл бұрын
Why max incremented by 1???
@crazyduniya128
@crazyduniya128 4 жыл бұрын
Harry sir java exercise solution kab aaega or aapne java ki videos ke notes bhi nahi diya please dijiye 😁😭🙏
@sumansingla9644
@sumansingla9644 4 жыл бұрын
Sir basic tutorial session ki series m comment kiya h mne please ta do
@java2308
@java2308 4 жыл бұрын
Can you make a video on how to find LCM of two numbers is JAVA
@ameygujre7674
@ameygujre7674 2 жыл бұрын
instead of incrementing 1 in every iteration, why don't we increment the maxNum as it's table. since it is pointless to check every single number with the increment of 1. We can simply iterate the table of max num till it is divisible by the least number..
@itrohitprajapati2114
@itrohitprajapati2114 4 жыл бұрын
Sir aap week students ke 'god' hai 🙏🙏🙏🙏🙏🙏🙏
@nitinverma1359
@nitinverma1359 4 жыл бұрын
bhai ye bta do ki tensorflow install kese krna hai Install krne pe error aa rha hai (pip install tensorflow ) se bhi error aa rha
@AshutoshKumar-ij5hw
@AshutoshKumar-ij5hw 4 жыл бұрын
Python code me while ke ander true likhne ke baad name true is not define esa error q aa ra h
@jitendradashora8956
@jitendradashora8956 Жыл бұрын
def is_smaller(num1, num2): if num1 < num2: return num1 else: return num2 def is_greater(num1, num2): if num1 > num2: return num1 else: return num2 def hcf(a, b): divisor = is_smaller(a, b) dividend = is_greater(a, b) while True: remainder = dividend % divisor dividend = divisor if remainder == 0: return divisor else: divisor = remainder def lcm(a, b): return (a * b) // hcf(a, b) while True: print(lcm(int(input("Enter your first number:- ")), int(input("Enter your second number:- "))))
@MohitKumar-dk2tt
@MohitKumar-dk2tt 4 жыл бұрын
Machine learning pa aur videos kab aaye gi
@rudrapatel2234
@rudrapatel2234 3 жыл бұрын
I found mistek in programme that we can't find LCM of numbers like 3,7,11,13,17,19,29,23
@jeenu123
@jeenu123 4 жыл бұрын
Please make unreal engine tutorials
@factlaunda6872
@factlaunda6872 4 жыл бұрын
Bhai ICSE Board Blue J Java pe video banao please 🙂
@vaibhav3852
@vaibhav3852 4 жыл бұрын
bhai mujhe isiki talash thi
@ScholarStream_25
@ScholarStream_25 4 жыл бұрын
Bro check that calculator of cbse students asap🙌
@danishmakrani8991
@danishmakrani8991 3 жыл бұрын
Sir 45 aur 60 ka lcm galat a raha hai yeh program se
@rsatishkumar1682
@rsatishkumar1682 2 жыл бұрын
Hi sir Can anyone explain maxNum=maxNum+1
@tanveerhussain9458
@tanveerhussain9458 4 жыл бұрын
Jakas
@blacksssharkvlogs4553
@blacksssharkvlogs4553 4 жыл бұрын
2nd
HCF/GCD of Two numbers Using Python
15:21
CodeWithHarry
Рет қаралды 71 М.
Program To Calculate LCM Of Two Numbers | Python Tutorials
19:20
Amulya's Academy
Рет қаралды 62 М.
女孩妒忌小丑女? #小丑#shorts
00:34
好人小丑
Рет қаралды 87 МЛН
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 42 МЛН
Which Operating System I use and Why 💻
14:57
CodeWithHarry
Рет қаралды 117 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
How Much Python Do You Need To Learn Before Django?
15:05
CodeWithHarry
Рет қаралды 186 М.
Python vs JavaScript | What to Choose? | ft. Toolify.ai
9:23
CodeWithHarry
Рет қаралды 136 М.
Java Program #30 - Find LCM of Two Numbers in Java
7:46
Programming For Beginners
Рет қаралды 13 М.
5 Effective Tips to learn Python fast!
15:57
CodeWithHarry
Рет қаралды 1 МЛН
女孩妒忌小丑女? #小丑#shorts
00:34
好人小丑
Рет қаралды 87 МЛН