Тёмный

Conditionals and Loops + Calculator Program 

Kunal Kushwaha
Подписаться 643 тыс.
Просмотров 703 тыс.
50% 1

In this video, we discuss conditionals and loops in Java. We cover if-else statements, adding multiple checks, for, while, do-while loops.
In addition to this, we also cover some questions to apply things into practice, and also create a calculator program.
Take part in the learning in public initiative! Share your learnings on LinkedIn and Twitter with #DSAwithKunal & don't forget to tag us!
👉 Resources
- Join Replit: join.replit.com/kunal-kushwaha
- Complete Java DSA playlist: • Java + DSA + Interview...
- Code, Assignments, & Notes: github.com/kunal-kushwaha/DSA...
➡️ Connect with me: www.techwithkunal.com
=========================================
Timestamps:
0:00 Introduction ‌‍‍‍‌‌‍‍ ‌‍‍‌‍ ‌‍‍‌‍‍‌‍ ‌‍‍‌‍‌‍‌ ‌‍‍‌‍‍‍‌ ‌‌‍‍‌ ‌‌‍‍‍
0:43 Creating New Project
1:28 Conditions
2:15 Syntax of if-else statements
2:54 E1 : if-else statements
4:56 Multiple if-else statements
7:20 Loops
8:46 Syntax of a "for loop"
9:28 E2 : for loop
12:40 E3 : for loop
14:23 Syntax of a "while loop"
14:48 E4 : while loop
17:00 When to use "for loop" and "while loop"
17:57 Syntax of a "do while loop"
18:22 E5 : do while loop
18:57 "while loop" vs "do while loop"
20:44 Solving Questions
20:51 Q1 : Largest number
28:12 Q2 : Alphabet case check
35:03 Q3 : Fibonacci numbers
43:00 Q4 : Counting occurrences
49:14 Q5 : Reverse
53:07 Calculator program
1:01:54 Outro
#loops #placement #dsa #interviews

Опубликовано:

 

1 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 676   
@KunalKushwaha
@KunalKushwaha 3 дня назад
DSA + interview preparation playlist: ru-vid.com/group/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ
@rishabhdhawad
@rishabhdhawad 3 года назад
This Java DSA Series is so Addictive 😍
@KunalKushwaha
@KunalKushwaha 3 года назад
Thank You!
@davs2002
@davs2002 3 года назад
@@KunalKushwaha this frequency of posting tutorials every alternate day is much better than posting every day as it gives us time to practice properly instead of rushing to keep up with you
@uncalledbrake603
@uncalledbrake603 3 года назад
@@davs2002 He already mentioned that he'll upload all videos and it will be self paced. Most of us here are in final year and want to brush up all concepts clear before the placements starts so it'll be better if he uploads 1 video everyday. Also you can watch videos alternate days and practice in between 😀
@sankiGunda.
@sankiGunda. 3 года назад
@@davs2002 bhai terko alternative day mei dekhni hai tho dekh sakta hai...par humare pass jada time nehi hai
@rishabhdhawad
@rishabhdhawad 3 года назад
@@uncalledbrake603 I am still in 2nd Sem 😀
@avanishdubey6556
@avanishdubey6556 3 года назад
I think now everyone can see the Beauty of Java.
@vedanthbaliga7686
@vedanthbaliga7686 3 года назад
Who the heck dislikes this😑. Thanks a lot for the efforts Kunal! Really appreciate it. The series has made me switch from Netflix to studying DSA 😂it's so addictive
@aryansharma4775
@aryansharma4775 3 года назад
cfc members 😂
@vedanthbaliga7686
@vedanthbaliga7686 3 года назад
@@aryansharma4775 Damn!😂🙏
@kaushalgolangade3879
@kaushalgolangade3879 2 года назад
Paid classes teachers was disliked this videos 😂😂😂
@eitoes
@eitoes 3 года назад
This course is very structured. Many tutorials explain concepts but ignore problem solving . Thank you kunal for this course
@sahilanand30
@sahilanand30 3 года назад
This is actually THE MOST premium course in the World!
@kalpoo23
@kalpoo23 2 года назад
Solving any problem flawlessly and with so ease. Wow! Your my new teacher. thanks for your simple and detailed teaching.
@sanketkumbhar8887
@sanketkumbhar8887 2 года назад
Favorite Line from all the lectures is: Very Simple Stuff
@Spider-Man_67
@Spider-Man_67 2 года назад
My god I'm amazed by the way u give us the way to build logic for problem-solving, thanks Kunal, never seen such an amazing playlist ever before, thanks, man!
@taongasoko4716
@taongasoko4716 Год назад
I literally just started this series and Oh my God this is pure gold!!,...thank you so much for simplifying everything for us
@ankit_1012
@ankit_1012 3 года назад
I haven't seen.. Anyone teach better..than u Really.. Awsm..
@parmarjaynareshbhai6610
@parmarjaynareshbhai6610 3 года назад
Really appreciate your effort 6 videos in 6 days really excited to learn from you.
@mdbillah9998
@mdbillah9998 2 года назад
You are the best Programmer explaining DSA such a unique way in Java. I absolutely loved it!!!
@Humanbeing485
@Humanbeing485 Год назад
kunal, you have no idea how much this course is boosting my confidence....i wish one day i could meet you and thank you personally....
@riddhijoshi1293
@riddhijoshi1293 Год назад
Such a great course , I can't stop myself playing next lectures ...doing it one by one
@tanoypaul
@tanoypaul Год назад
Kunal Sir, please continue the series. It would help all of us a lot 🤞🏻The quality you provide is unmatchable. 💥
@MarkusEicher70
@MarkusEicher70 Год назад
Many thanks, Kunal! 🤛 This lesson was a good opportunity for me to practice loops and conditions. Something that for many more experienced developers surely is daily business. I try to make it a habit to first write the pseudo code and the flowchart for the assignments and then I go over to code the solution in Java, JavaScript and Go. This takes a ton of time, but this way the stuff sticks in my old brain. I appreciate your contribution to free education. 🤝
@KunalKushwaha
@KunalKushwaha Год назад
Wonderful!
@shubhamagarwal1434
@shubhamagarwal1434 9 месяцев назад
# GOD Of DSA Hi I am a 11yr exp java guy was searching for some free course on youtube for DSA came accross your course and i just feel love in it...all in one place that too with java...i must say you have done very awsome work...your name will be there on this earth as long as DSA will be asked in interviews...May Supream Lord Vishnu Bless You..✌🙏
@user-ig9xc9ws4s
@user-ig9xc9ws4s 6 месяцев назад
Hi Shubham, which tech stack are you working now?
@vikastyagi1607
@vikastyagi1607 Год назад
Learning DSA has never been this much fun.
@Siddharth3029
@Siddharth3029 Год назад
Bhaiya isme java language basics se padhai hai kya kyuki Mai beginner hu please reply
@nsitkarana
@nsitkarana Год назад
@@Siddharth3029 yes. its covering from the basics. go for it
@niharikabhardwaj2357
@niharikabhardwaj2357 23 дня назад
Can u pls tell from where did u cover the topics mentioned
@bask-x86
@bask-x86 4 месяца назад
One of the best tutorials so far in RU-vid (Java). Thank you Kunal
@abhaykumar0215
@abhaykumar0215 3 года назад
Thanks a lot for such kindness where u r teaching DSA and not charging any penny...
@bikramsaha1932
@bikramsaha1932 3 года назад
Awesomeeee🔥 i am literally addicted to this series.. this 2 day gap felt like a lifetime😂..
@KunalKushwaha
@KunalKushwaha 3 года назад
I uploaded 6 videos in 6 days what else do you want?
@hammad8965
@hammad8965 3 года назад
@@KunalKushwaha May be he is the one who already know basics 😁
@bikramsaha1932
@bikramsaha1932 3 года назад
@@KunalKushwaha are na na i didnt mean like that i just meant such is the quality of the content.. it makes waiting worth it😅.. sorry if i choose the wrong words
@whycm
@whycm 3 года назад
Bhai CIVO channel p v deveops ka bootcamp mein padha rhe h aur twitch p v Opensource(MLH) k liye kl podcast kiye the...so if you are interested in these, you may follow these videos.
@maheshmoholkar8088
@maheshmoholkar8088 3 года назад
More videos!!!
@lavanyam3224
@lavanyam3224 3 года назад
Hey Kunal! Don't feel pressurized coz of the comments asking for more videos. The frequency and quality of your video is awesome! Cheers and take ur time! Thanks a lot for this commitment ;))
@urjasvi
@urjasvi 3 года назад
this comment should get a 💖
@Siddharth3029
@Siddharth3029 Год назад
Bhaiya isme java language basics se padhai hai kya kyuki Mai beginner hu please reply
@mirraza4692
@mirraza4692 Год назад
@@Siddharth3029 yes
@Securitywasted128
@Securitywasted128 Год назад
Even my proffessor won't teach like that you.Great man kudos to you.
@ZenHiker.
@ZenHiker. Месяц назад
Day 10 of DSA learning ✅
@tysonryuk6664
@tysonryuk6664 26 дней назад
Chup bkl
@akrajeshwar
@akrajeshwar 21 день назад
​@@tysonryuk6664 wow so edgy
@akhilreddybollu5551
@akhilreddybollu5551 3 года назад
Every one can teach but no one teach like you 🥰🥰🥰 Waiting for your next video 😍😍🥰
@amansrivastav6885
@amansrivastav6885 11 месяцев назад
this course is in very detail for begginers and covers all important concepts
@debasishchakraborty4196
@debasishchakraborty4196 2 года назад
All of your videos from basic to advanced are unavoidable due to your super smart style of teaching. It's a gift for many of us beginner or experienced who so ever I believe.
@KunalKushwaha
@KunalKushwaha 2 года назад
You're very welcome!
@debasishchakraborty4196
@debasishchakraborty4196 2 года назад
@@KunalKushwaha one biggest plus point in all your teachings , you are successfully able to generate interest on such difficult topics like DSA of folks watching these videos in a true sense
@ViPuL2006
@ViPuL2006 22 дня назад
i don't understand the Fibonacci Program.
@dhruvirajyaguru7170
@dhruvirajyaguru7170 2 года назад
thank you finally find a tutor whom gave great content ❤
@pooja6380
@pooja6380 Год назад
thank you for such amazing playlist....😍Its really helpfull👍
@mainakroy7781
@mainakroy7781 3 года назад
Good stuff 👍 Kunal . This series is gonna be great . Excited or what!
@ammupradeep9360
@ammupradeep9360 2 года назад
Yes its really blessing to come through your channel lots of love❣️
@emmanueladesope4178
@emmanueladesope4178 Год назад
Thanks so much Kunal. You are a blessing.
@salonijain8943
@salonijain8943 2 года назад
I never stick onto RU-vid lectures series for a long time. But this one has my ❤️
@iUtkarsh21
@iUtkarsh21 Год назад
Hey seriously I am not getting anything what he is teaching but I completely want to learn what should I do. I don't know anything about coding.
@lakshaydahiya618
@lakshaydahiya618 Год назад
@@iUtkarsh21 first learn C or C++ then you will understand , I also didn't understand anything but after learning C I can understand most of it.
@imnone
@imnone 10 месяцев назад
no learn from durga sir no need of c i never learnt it @lakshaydahiya618 @I@@iUtkarsh21
@sharannarsingi7578
@sharannarsingi7578 9 месяцев назад
52:43 Even if you print the rem variable the answer will be the same i.e. reverse of that num, all you need to do is initialize the rem variable outside the while loop. THANK YOU for a clear explanation
@vaibhavimishra763
@vaibhavimishra763 10 месяцев назад
You are best, the work which u r doing really God will bless u for this🙏🙏👏👏
@peakygeekyreviews8451
@peakygeekyreviews8451 Год назад
noone could teach as better as kunal sir,mean my words guys this is the most understanding and easy explained coarse just follow the assignments question to build more confidence ,and see the result after a month that the level is increased,i highly appreciate this work done by kunal sir i wish i could meet and thanks for all this.
@AnimatedBollywood
@AnimatedBollywood Год назад
Dont't worry ! I am with you
@user-lq2yu8zp5y
@user-lq2yu8zp5y 8 месяцев назад
Its great DSA course ever, first time coding seems interesting😍
@davidmurege
@davidmurege 9 месяцев назад
One of the best. This will make pro. Kunal kudos
@Vishwask22
@Vishwask22 Год назад
This is Amazing bro! Learnt & practiced as well.
@zhengen
@zhengen 2 года назад
Some of the questions here are easy leetcode questions. Awesome work Kunal
@PraphullaJadhav
@PraphullaJadhav Год назад
Hi Kunal your work is amazing ...I've been working since last 7yrs in IT but I never know how to reverse number & Fibonacci series logic I was just remembering it as I never understood it Thanks brother seriously.
@haris7521
@haris7521 2 года назад
love this dude , thanks Kunal for the DSA
@prasannajaga3584
@prasannajaga3584 2 года назад
keep on coming kunal ! it's really feels awesome ...
@nishant3904
@nishant3904 3 года назад
I Must say these videos are CLEAN !
@priyankarajput3105
@priyankarajput3105 2 года назад
In the way, you explain things, is too good.
@Soyeb01YT
@Soyeb01YT 2 года назад
Completed assignment, Awesome explanation.... Moving to next one
@himanshushukla6451
@himanshushukla6451 2 года назад
you solving questions was an eyeopener
@Ahmadsadiq21
@Ahmadsadiq21 2 года назад
This is the best way of teaching.
@safvanp1680
@safvanp1680 2 года назад
Thank you so much for this series
@nobody124...
@nobody124... 3 месяца назад
well explained than my college lecturer first i was hating java but now i am loving it
@AnkurKumar-wg3on
@AnkurKumar-wg3on Год назад
great video kunal, hands on learning. Feel so much more confident about programming in java.
@AnimatedBollywood
@AnimatedBollywood Год назад
Dont't worry ! I am with you
@user-zb2ee1yg5v
@user-zb2ee1yg5v 9 месяцев назад
Love this course Sir It is really amazing 🤩
@sabrinanastasi5809
@sabrinanastasi5809 2 года назад
If I could, I would write this in every video: nobody dedicated so much on the internet to teach such complex subjects in a clear, crystal-clear manner, besides the amazing quality. And tks for teaching in English, I am a native Portuguese speaker and I have English as a second language, however, most of the good videos are available in Hindi and have no translation to English. Tk you forever!! (I have you as a reference in terms of learning, better than all my professor in computer science college adding altogether)
@KunalKushwaha
@KunalKushwaha 2 года назад
Thank you
@harishrajwani3697
@harishrajwani3697 Год назад
@@KunalKushwaha bhyia pls continue DSA series you're much much much better than those paid courses
@factmania0803
@factmania0803 Год назад
@@harishrajwani3697 bhai kunal bhaiya ne dsa series complete kiyi to best series hogi
@sahilanand30
@sahilanand30 3 года назад
This man has removed the fear of java from my mind!
@shekharkumar3535
@shekharkumar3535 2 года назад
Great Explanation brother. Really motivating...
@amosujames2818
@amosujames2818 Год назад
Thanks a lot Kunal! Enjoy this section.
@lakshaysharma6390
@lakshaysharma6390 Месяц назад
Thank You Sir 🙏
@congomigue9072
@congomigue9072 5 месяцев назад
I am enjoying the series by Kunal, literally binge watching this Kunal playlist. I tried to modify the calculator program here and added just a few logic: import java.util.Scanner; public class Calculator { public static void main(String[] args) { // The calculator program tutorial by Kunal; Scanner input = new Scanner(System.in); // takes in user input // Calculation logic. // should be a loop while (true) { System.out.println("Enter the operator to use "); // takes the operand we'll be using char op = input.next().trim().charAt(0); if (op == '+' || op == '-' || op == '/'|| op == '*' || op == '%'){ System.out.println("Enter the 2 numbers to use "); int res = 0; int num1 = input.nextInt(); int num2 = input.nextInt(); boolean validCalculation = true; if (op == '+') { res = num1 + num2; } else if (op == '-') { res = num1 - num2; } else if (op == '/') { // But we cant divide a number by 0, it will throw an error. if (num2 != 0) { res = num1 / num2; } else { System.out.println("Hey there, this is not valid as it will return infinity"); validCalculation = false; } } else if (op == '*') { res = num1 * num2; } else if (op == '%') { if ( num2 != 0) { res = num1 % num2; } else { System.out.println("Hey there, this is will result to an error, cant have this"); validCalculation = false; } } if (validCalculation){ System.out.println("Your result is " +res); } } else if ( op == 'x' || op == 'X') { break; } else { System.out.println("Invalid Operator"); } } } }
@shashwathsk5266
@shashwathsk5266 3 года назад
bro thanks for providing such a quality content
@singhkr
@singhkr Год назад
Take precautions before watching this course You will be addicted to this DSA course and fall in love with DSA 😄😆💯
@_I_am_AI
@_I_am_AI 6 месяцев назад
@KunalKushwaha 52:09 why we are adding the numbers but we can simply do ...... public class reversingNumber { public static void main(String[] args){ int n = 28479; while (n>0){ int x = n%10; System.out.print(x); n = n/10; } } }
@Harsh-wr7ov
@Harsh-wr7ov 2 года назад
honestly speaking, i m in 2nd yr, and this is the first time i could understand while loop, kudos man u r greattt
@shubhsingh9787
@shubhsingh9787 Год назад
same here vroo....
@DevTech.s
@DevTech.s 5 месяцев назад
Then how did you make it to 2nd year, if you don't even know basic loops 😂
@innocentgamer8670
@innocentgamer8670 10 месяцев назад
51:57 another method to solve this is ,, class Main { public static void main(String[] args) { long n = 198451318728144l; long rev = 0; while(rev
@ajaysairam1747
@ajaysairam1747 2 года назад
i have learnt the new approach to find the largest number WOW!
@sabihasamreen3621
@sabihasamreen3621 9 месяцев назад
This is the best lecture series so far.. Thankyou!
@KunalKushwaha
@KunalKushwaha 9 месяцев назад
You're very welcome!
@harmankaur3938
@harmankaur3938 Год назад
Thanku kunal for this amazing playlist😇
@clownyt4310
@clownyt4310 Год назад
Dammm addictiveee ❤️🔥🔥❤️..may god bless youu 💓
@RohitKumar-zp6ci
@RohitKumar-zp6ci 25 дней назад
Seriously, very helpful, i am able to think and execute logics on my own. You are just amazing. 47:00: Try this : public class CountNums { public static void main(String[] args) { String str = "12343"; int count = 0; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == '3') { count++; } } System.out.println(count); } }
@siddheshdeshmukh3635
@siddheshdeshmukh3635 6 месяцев назад
at 50:59 we can use print without multiplying with 10 public class reverse { public static void main(String[] args) { int a=83574; int nxt=0; while(a>0) { int mod=a%10; nxt=mod; System.out.print(nxt); a=a/10; } } } it's output is 47538 !!!!!
@jaypandya7801
@jaypandya7801 Год назад
Q1 : using operators //Q:find maximum of three numbers int max = a; if (b> max && b > c){ System.out.println("The maximum number is : " + b); }else { System.out.println("The maximum number is : " + c); } }
@vrfod
@vrfod 2 года назад
kunal bhaiya i know you must be busy but adding a lecture of you doing an open source project using what we have learnt so far in this course will make it absolutely complete because what most of us lack is implementation and it'd mean the world to us if you'd think about it. Thank you for everything
@iqbalfirdousi9732
@iqbalfirdousi9732 2 года назад
+1
@zishanchaudhary221
@zishanchaudhary221 Год назад
@@iqbalfirdousi9732 +2
@Abhi-ng3re
@Abhi-ng3re Год назад
+3 totally !!!
@shehryar6046
@shehryar6046 Год назад
fr
@adeshkhandait
@adeshkhandait 3 года назад
Great work!!!
@vanshajduggal
@vanshajduggal 3 года назад
Great job man,love your videos.Kindly do share your journey as a programmer till now.
@satyampandey3136
@satyampandey3136 2 месяца назад
Thank you so much!! I really mean it.
@ishaikhmd
@ishaikhmd 2 года назад
Excellent job U R Doing 👍🏻👍🏻
@NitinSingh-cs6lp
@NitinSingh-cs6lp 3 года назад
Java DSA ...U MADE THE TOUGH ONE SO EASY . Hats off
@user-fz1iz5ej9j
@user-fz1iz5ej9j Месяц назад
#Superb series Kunal Bhaiya #one & only one😎 #Eazy to understand #No.1 Java+DSA
@_hulk748
@_hulk748 Год назад
Great Explanation Sir🙇‍♂✨🙏❤
@sivaramapandian3923
@sivaramapandian3923 3 года назад
Turned out as an inspirational ♥️
@shrujaigupta1803
@shrujaigupta1803 2 года назад
thank you bro!! it helped me a lot❤
@abhishekanxnd
@abhishekanxnd 7 месяцев назад
Keep up the good work Kunal! Cheers!
@sneharoy5444
@sneharoy5444 2 года назад
the best series on youtube even paid courses are not like this.. hats of to you kunal
@AbhishekSharma-me
@AbhishekSharma-me 2 года назад
Thanks for the wonderful lectures, theres not even a single day I skipped your lectures from the past week.
@KunalKushwaha
@KunalKushwaha 2 года назад
Glad you like them!
@aayushi_mittal
@aayushi_mittal 3 года назад
Amazing!! 💯
@codewithraj9517
@codewithraj9517 2 года назад
Amazing thank u for great content all time
@ShubhamYadav-it7tw
@ShubhamYadav-it7tw 2 года назад
leatraly i don,t have words to say thanks to kunal ❤
@stacktuber
@stacktuber 6 месяцев назад
I love your answer, my solution was: //Q: Reverse the given integar int n = 16674; String numStore = ""; while(n > 0){ int last = n % 10; String lastString = Integer.toString(last); numStore += lastString; n /= 10; } int numInt = Integer.parseInt(numStore); System.out.println(numInt);
@JSDEVD
@JSDEVD Год назад
Thnks kunal for this. Any person can understand this...
@BibekGhoshh1
@BibekGhoshh1 2 года назад
it is actually fun ....i enjoyed whole video...
@sigmaprideu
@sigmaprideu Год назад
Bro I was planning to buy course of DSA JAVA from coding ninja and suddenly i searched on RU-vid and start playing your videos .Now i am addicted to your channel.Thank you for uploading these quality course,you saved my money.❤❤❤
@jasper5016
@jasper5016 Год назад
You are really talented and you know how to teach others. Glad I found your channel to learn DSA. Thanks Kunal!
@Siddharth3029
@Siddharth3029 Год назад
Bhaiya isme java language basics se padhai hai kya kyuki Mai beginner hu please reply
@dherya__rakho
@dherya__rakho Год назад
​@@Siddharth3029brother kya tumne yeh start kia?
@Siddharth3029
@Siddharth3029 Год назад
@@dherya__rakho nahi mai devlop sikh rahu hu abhi baad me dsa karunga
@dherya__rakho
@dherya__rakho Год назад
@@Siddharth3029 web dev? But why.... Agar tum Java pehle karte toh tumhe baad mei web d mei bhi asaani hoti
@yashtibra3684
@yashtibra3684 3 года назад
Great video. Love the content
@priyanshusharma5278
@priyanshusharma5278 3 года назад
Great work!!😄
@work_sanskriti6369
@work_sanskriti6369 Год назад
these videos also "make sense !!" ....... I would love to loop my thanks to infinity times
@perveenneha1423
@perveenneha1423 3 года назад
kunal can you please also start open source guide because many of us have completed a major portion of the basics and would like to get experience in open source. I know you are working very hard for us and you are busy with everything. but it would be great help if you just started somethings with open source also. please . I appreciate the hard work you are doing for the community.
@japmeetsingh635
@japmeetsingh635 3 года назад
Thank you So much for such awesome content and that too for free😍😍
@KunalKushwaha
@KunalKushwaha 3 года назад
Glad you enjoy it!
@rangitsengupta3025
@rangitsengupta3025 3 года назад
Eagerly waiting for other upcoming videos
@kushagraarora8899
@kushagraarora8899 3 года назад
Great work 👍 !!!