Lecture 8: Switch Statement & Functions

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

Комментарии • 3,1 тыс.

  • @vaishnaviupadhyay2239
    @vaishnaviupadhyay2239 3 года назад +779

    HOMEWORK QUESTIONS:
    1) HOW WILL YOU EXIT IF YOU PUT SWITCH CASE INSIDE INFINITE LOOP AND WHEN YOU CAN'T USE SWITCH STATEMENT?
    CODE:
    #include
    #include
    using namespace std;
    int main()
    {
    //this while condition will always be true if exit( is not put.)
    while(1)
    {
    cout

    • @hodl1932
      @hodl1932 2 года назад +33

      Kudos to you🙌
      For writing that much

    • @karanraoexperiment
      @karanraoexperiment 2 года назад +30

      You are an Incredible 🙌 and so sincere student. Love Babbar Bhaiya will proud of you.

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

      God 🙏🙏🔥

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

      @@hodl1932 thanku so much ✨

    • @vaishnaviupadhyay2239
      @vaishnaviupadhyay2239 2 года назад +2

      @UCVfANS1XPuU7z4ueDOmr_2A ohh thanks Karan , it means a lot 😀

  • @AmarjeetKumar-nt3uj
    @AmarjeetKumar-nt3uj Год назад +141

    Timestamp 23:44
    note example.
    #include
    using namespace std;
    int main ()
    {
    int amount;
    cout

    • @T1s_kashyap
      @T1s_kashyap Год назад +7

      You cleared my doubt thanks bro 👍🏻. Appreciated 😊.

    • @niladrisaha5441
      @niladrisaha5441 Год назад +1

      thanks to you I now understand this switch case

    • @pranjaltiwari4959
      @pranjaltiwari4959 9 месяцев назад

      thanks

    • @RajveerSingh-zg9vd
      @RajveerSingh-zg9vd 9 месяцев назад

      @@pranjaltiwari4959 Appreciated ..

    • @MaheshGajbhiye-w5d
      @MaheshGajbhiye-w5d 6 месяцев назад

      Inside the switch-case statement:
      Case 1:
      You calculate the number of Rs.100 notes required by dividing the amount by 100 and storing the result in the variable note.
      You update the amount by subtracting the total value of Rs.100 notes.
      You print the number of Rs.100 notes required.
      Case 2:
      Similarly, you calculate the number of Rs.50 notes required.
      Update the amount and print the result.
      Case 3:
      You calculate the number of Rs.20 notes required.
      Update the amount and print the result.
      Case 4:
      You calculate the number of Rs.1 notes required.
      Update the amount and print the result.

  • @illuxionist
    @illuxionist Год назад +143

    your DSA course is the bestt! I already tried apni kaksha and code with harry's videos on these topics but they can nowhere reach the level of simplicity that you reach, once again thank you very much for this awesome course!

    • @Quavo-goa
      @Quavo-goa 9 месяцев назад +12

      absolutely true...this guy is so positive and simple in understanding and also he has started this series from basics so its fun

  • @virajdeshpande9821
    @virajdeshpande9821 2 года назад +485

    Home work 1, 14:16
    using switch case in infinite loop , here we are using exit(0);
    there are primarily two types of exit();
    1. exit(0) which is the exit successfully which means program has run successfully and then it is terminated. i.e. program has been executed without any error or interrupt.
    2. exit(1) Exit Failure: Exit Failure is indicated by exit(1) which means the abnormal termination of the program, i.e. some error or interrupt has occurred. We can use different integer other than 1 to indicate different types of errors.
    #include
    #include
    using namespace std;
    int main()
    {
    int n;
    cin >> n;
    while(INT_MIN){
    switch (n){
    case 1: cout

    • @gourabchowdhury5603
      @gourabchowdhury5603 2 года назад +2

      note

    • @nevernew9348
      @nevernew9348 2 года назад +8

      Bro apke question me keval ek hi case chal raha hai baki nahi chal rahe hai kirpya karke apne code ko dekhe

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

      @@hrishikeshgawde579 ok bro

    • @collegematerial5348
      @collegematerial5348 2 года назад +1

      Switch me 1 kyo pass kiya

    • @yashbhamare4772
      @yashbhamare4772 2 года назад +2

      ​@@collegematerial5348 it by default executes the code if u pass 1 cuz 1= true in binary

  • @motivation_with_harsh
    @motivation_with_harsh 2 года назад +11

    pass by value questions ->
    1st question -> 10
    2nd question -> 15
    3rd question -> 196

  • @vikalpborkar2162
    @vikalpborkar2162 Год назад +15

    Homework Questions- 1:06:20
    1)
    int nth_term(int n){
    return (3*n + 7);
    }
    int main(){
    int n;
    cout n;
    cout

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

      Bhai for loop explain karoge kya wo range ?

    • @anirudh8769
      @anirudh8769 Год назад +6

      //total no of set bit in 2 nos
      #include
      using namespace std;
      int no_sbit(int n){
      int b,s=0;
      while (n!=0){
      b=n&1;

      s+=b;

      n>>=1;
      }
      return s;
      }
      int tno_setb(int a, int b){
      int ans ;
      ans = no_sbit(a)+no_sbit(b);
      return ans;

      }
      int main(){
      int num1,num2;
      cout > num1 >> num2;

      cout

    • @anirudh8769
      @anirudh8769 Год назад +3

      @@TheHariPutraOfficially bhai better understanding ka liya loop ko for(int i=3;i

  • @krishnakant2351
    @krishnakant2351 Год назад +18

    1:08:12
    homework question no. 3 of fibonacci series is
    #include
    using namespace std;
    int fibbo(int n)
    {
    int a=0 , b=1 , c;
    for(int i=1 ; i

    • @ayushpal4389
      @ayushpal4389 8 месяцев назад

      please explain why we return a in fibbo function

    • @KrishnaGupta-kw6he
      @KrishnaGupta-kw6he 8 месяцев назад

      Hi brother ​@@ayushpal4389

    • @ayushpal4389
      @ayushpal4389 8 месяцев назад

      Instead of a+ b so we can get one more number in series

    • @KrishnaGupta-kw6he
      @KrishnaGupta-kw6he 8 месяцев назад

      @@ayushpal4389 no brother fibonacci me third number previous alternative numbers ka sum hota he

    • @ayushpal4389
      @ayushpal4389 8 месяцев назад

      @@KrishnaGupta-kw6he I know brother but we can also return a+ b so we get one more number in series

  • @bhavinravalia9285
    @bhavinravalia9285 2 года назад +52

    1:20:18
    perfect example for understanding pass by value👍

  • @ArjunSingh-kg7zs
    @ArjunSingh-kg7zs Год назад +8

    Bhai kammal ka course hai hats off to you...
    Previously I was thinking ki itna badi playlist hai itni lambi lambi videos hai deku ki nhi but jab maine shuru kiya bhai.. maza aa gaya. Phaze one ke sare topics maine phle se hi aate hai but har video me kuch naya sikhne ko milta hai bhai tabi phir se ari videos dekh raha hu and yes thankyou very muvh bhai ye course bane ke liye thankyou thankyou thankyou..... Jai Shree Ram

  • @OutOfFocus-lr9tg
    @OutOfFocus-lr9tg 2 года назад +21

    I am enjoying this course.Cannot thank you enough@babbar op
    hw q 2.
    #include
    using namespace std;
    int nofsetbit(int num)
    {
    int count=0;
    while(num)
    {
    if(num&1==1)
    {
    count+=1;
    }
    num=num>>1;
    }
    return count;
    }
    int main()
    {
    int a,b;
    cin>>a>>b;

    int set_bits_in_a=nofsetbit(a);
    int set_bits_in_b=nofsetbit(b);
    cout

  • @NileshRaut6000
    @NileshRaut6000 3 года назад +22

    26:08
    #include
    using namespace std;
    int main(){

    int amount=0,hundred=0,fifty=0,twenty=0,ten=0,one=0,modulus=0,remainder=1;
    cout

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

      Only case 1will be executive..what about others?

    • @riteshmohanty1448
      @riteshmohanty1448 2 года назад +2

      @@kamrulansari21 He didn't use break, so all 5 cases will be executed.

    • @kamrulansari21
      @kamrulansari21 2 года назад +1

      @@riteshmohanty1448 yeah later i got to know ..btw thanks buddy..

    • @crazybeats7112
      @crazybeats7112 Месяц назад

      int n;
      cout

  • @arshhdahiya400
    @arshhdahiya400 Год назад +5

    Bahiya ab tak iss series ki saari video dekhi hai bina ek minute skip kiye huye, har ek question khud se solve krne ka try kia hia,, my personal review till now "It is The Best DSA series out there", Mazaa aa gya,, Love you

  • @factozone702
    @factozone702 2 года назад +65

    Homework Questions ---> 1:06:20
    Q1-->
    #include
    using namespace std;
    int APterm(int num){
    int ans = 3*num + 7;
    return ans;
    }
    int main(){
    int n;
    cout

    • @MUKESHKUMAR-lg8rl
      @MUKESHKUMAR-lg8rl 2 года назад +1

      your 5th code is wrong

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

      Bhai last Wale me nth term ki value nikalni hai puri series nhi

    • @RedSpade01
      @RedSpade01 Год назад +8

      Bro,Fibonacci wale mein sirf ik value print karwani hai
      yeh wala dekh le
      #include
      using namespace std;
      int fibonacci(int n){
      int a=0;
      int fib=1;
      int b=1;
      int i =1;
      while(i>n;
      cout

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

      Bhai 43:54 me Jo return 0 aur return 1 likha hai wo kaise hua??

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

      ​@@shortsarena1105 bcz bhaia ne function ka return type 'bool' diya hai... aur bool data type sirf 0 ya 1 return krta hai... 1 ki jagah tum koi bhi non- zero value return karwa skte ho, but 0 ke jagah 0 hi rhne dena, usko change nhi krna... kyunki by default system kisi bhi non-zero value ko TRUE means (1) treat krta hai, aur zero ko FALSE means (0)...

  • @allinone.4398
    @allinone.4398 2 года назад +4

    This man is truly fantastic...Ek babbr indian cricket ko smhal rha hai and dusra babbr hamare Future ko.Bhai pure youtube me inse acha teacher nhi mila melo.thank you boss.i am going to subscribe to your channel.

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

    23:44
    int n;
    cout

  • @dantriksh2762
    @dantriksh2762 Год назад +5

    1:22:51 HW
    Q1: 10
    Q2: 15 ( because we are printing "a" not "update(a)")
    Q3: 196

    • @darpandaswani04
      @darpandaswani04 Год назад +1

      I think q2 will give error as we are not accepting value returned by called function.

  • @deepakyadavYT
    @deepakyadavYT Год назад +7

    I watched the entire video and it took me 4 hrs to digest it all. and I'm happy that I invested this time to learn it.

  • @AkhileshKumar-xv2hr
    @AkhileshKumar-xv2hr Год назад +2

    1:07:06
    Question- Find the number of set in number a and b.
    #include
    #include
    using namespace std;
    int DtoB(int m){
    int i=0,ans=0;
    while(m!=0){
    int bit=m&1;
    ans=bit*pow(10,i)+ans;
    m=m>>1;
    i++;
    }
    return ans;
    }
    int setbit(int n1,int n2){
    string x=to_string(DtoB(n1));
    string y=to_string(DtoB(n2));
    string s=x+y;
    int count=0;
    for(int i=0;i>a>>b;
    int answer=setbit(a,b);
    cout

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

      Answer thik hai par itna complex karne ki kya jarurat thi 😂

  • @creativeamar
    @creativeamar 2 года назад +22

    bhai kya padhate ho yaar.. awesome ❤ I have 8 years of working experience, just started your course a few days ago and these videos are really wow. :)

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

    1:06:55
    QUE:- Bit set
    #include
    using namespace std;
    int count(int n)
    {
    int bit = 0;
    while (n != 0)
    {
    if (n & 1)
    {
    bit++;
    }
    n = n >> 1;
    }
    return bit;
    }
    int bits(int a, int b)
    {
    int total = count (a) + count (b);
    return total;
    }
    int main ()
    {
    int a, b;
    cout a;
    cout b;
    int ans =bits(a,b);
    cout

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

      Bro excelleNT BUT!! how to execute program of BITSCOUUNTING if we have input a negative integer and we want to count the negative integer's bits also ?

    • @vaibhavmankar8178
      @vaibhavmankar8178 2 года назад +1

      Bhiyya love bhiya ne time complexity se handwritien notes nahi Dale hai aaisa kyu?

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

      @@vaibhavmankar8178 pata nhi

  • @theMultiverse8
    @theMultiverse8 Месяц назад +1

    1:24:47 - I'm enjoying this course. This course is very helpful. Thank you sir.

  • @sayanmandal6079
    @sayanmandal6079 11 месяцев назад +18

    The videos are 2 years old now, but the level that they are at, I don't think any other course on youtube is able to impart knowledge with this simplicity. Spending so much time on basics so that the base is strong is really important. Looking forward to comment on the last video that FINALLY COMPLETED THE DSA PLAYLIST!!
    Thanks a lott bhaiya

    • @nothing.....196
      @nothing.....196 8 месяцев назад

      ​@armansoni3692me too

    • @codewith404
      @codewith404 2 месяца назад

      @armansoni3692 bro what about your DSA study... Have you completed the DSA

  • @p.s.dasica
    @p.s.dasica 2 года назад +47

    aaj tak functions clear hi ni hua ache se aur college ke 4th year me aagye...ab jake pura concept ekdum clear hogya just because of you bhaiyaaaa....how should I thank you SIR?🙏🙏❤❤🧡🧡🧡 You are god of millions students❤❤❤❤❤

  • @_goutam_kr._
    @_goutam_kr._ 10 месяцев назад +3

    First of all love you bhaiya for this amazing series
    Bhaiya currently i am in 2nd Semester and i start this C++ DSA series and today i watch this complete video lecture based on switch statement and function...

  • @avibirla9863
    @avibirla9863 3 года назад +75

    Bhaiya kya padhate ho aap 🔥 Hats off !!! Bus ese hi till end of this complete series ese hi in dept padhana .....aapka ye course aane k baad confidence aaya ..Microsoft,fb, product companies Crack karni h bus abhi toh !!! .....

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

      ruclips.net/video/zM6G0gOVP58/видео.html
      git and github tutorial

    • @KillerPro-pw2cb
      @KillerPro-pw2cb Год назад +1

      Kaha ho Bhai abhi

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

      Bhai tu kaha hai aaj ??

    • @avibirla9863
      @avibirla9863 11 месяцев назад +3

      @@aaravanand2325 developer at IDFC First Bank

    • @muhammad_Dilawar_
      @muhammad_Dilawar_ 7 месяцев назад

      great....man@@avibirla9863

  • @veditakamat6060
    @veditakamat6060 2 года назад +9

    1:22:54 Output 1: 10, Output 2: 15, Output 3: 196

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

      Sure?

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

      can u please help me in question 2
      why only 15 gets printed.
      in update function we return a = a-5;
      so the answer should be 10 and 15 both

    • @S.P.5001
      @S.P.5001 2 года назад

      @@Reehan bhai value return ho rhi update me par initialize nai ho rhi hai kahi bhi ..to us return ka koi matlab hi nai raha

    • @S.P.5001
      @S.P.5001 2 года назад

      @@Reehan basics clear krne hai to saurabh shukla sir ke lectures dekh lo

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

    @ 1:08:04 hw que solution
    CPP:
    #include
    using namespace std;
    int fibonacci( int n){
    int fib0 = 0;
    int fib1 = 1;
    int fib;
    cin>> n;
    for(int i =1; i

  • @hemantporwal6766
    @hemantporwal6766 Год назад +5

    25:18
    // if a given amount is given to you then we have to calculate how much 100 notes,50 notes,20 notes and of 1 note it required to make the given amount
    #include
    using namespace std;
    int main() {
    int n;
    cout n; // n=1470
    switch (1){ // (multiple switching will be there)
    case 1: // (for 100)
    int a=n/100; // a=14
    int c=n%100; // temp=70
    cout

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

    // HOMEWORK 14:25
    // how to exit an infinite while loop when we have a switch case inside that loop.
    #include
    using namespace std;
    int main()
    {
    int n;
    cout n;
    while (n) // this is an infinite loop because n is always going to be true
    {
    switch (n) // switch case enabled - to provide an output to the value of n
    {
    case 23:
    cout

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

      Code is good it should work because i also tried viewing your problem but didn’t stuck in any loop 😇
      Try saving and running again !!

  • @crazybeats7112
    @crazybeats7112 Месяц назад

    1:06:50 answer of que :1 is
    int ap(int n){
    int ans=1;

    for(int i=0;n>=i;i++){

    ans=(3*n+7);
    }
    return ans;
    }
    int main(){
    int n;
    cin>>n;
    cout

  • @zoya5034
    @zoya5034 3 года назад +43

    Sir you are great..this is my first comment on RUclips 😅.. I am in btech 3rd yr and my coding was very weak now I am trying by seeing your videos it gives me hope.. Please sir solve more problems from LEETCODE.... Please sir...

    • @deetan1550
      @deetan1550 Год назад +3

      Hello Zoya, Now i am in your situation. I am also in 3rd year and coding is very weak. How you prepared for placements? Did you got any job after completing this dsa series??
      Please reply!!

    • @Tillu_bhai-o1c
      @Tillu_bhai-o1c Месяц назад

      @@deetan1550 bhai mili

    • @8L4CK_P4NTH3R
      @8L4CK_P4NTH3R 5 дней назад +1

      got placement?

  • @iUmerFarooq
    @iUmerFarooq 2 года назад +30

    *Home Work*
    #include
    using namespace std;
    15:24 Use exit() in infinite loop inside switch.
    int main() {
    cout

    • @careerwithmann481
      @careerwithmann481 2 года назад +1

      thanku so much for answer,

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

      Bro output kay q.2 may 15 ayga

    • @rishabhchaudhary6207
      @rishabhchaudhary6207 2 года назад +2

      learn dsa from imran khan..... what are you doing here

    • @iUmerFarooq
      @iUmerFarooq 2 года назад +1

      @@rishabhchaudhary6207 hahaha I Lough so hard...
      I wish he know this 😁😁

    • @rishabhchaudhary6207
      @rishabhchaudhary6207 2 года назад +1

      @@iUmerFarooq
      I know because he is a beggar 😂😂😂😂

  • @nayankumar6304
    @nayankumar6304 2 года назад +1

    answer of homework question --------> 26:00
    #include
    using namespace std;
    int main()
    {
    int amount;
    int x, y, z, p, q, r, s;
    cout amount;
    switch (true)
    {
    case 1:
    x = amount / 100;
    cout

  • @shaksham547
    @shaksham547 2 года назад +257

    i had Cs since 11th chose ECE in college and had some coding languages there too but never got interested in learning , guess i was too lazy.
    Now I'm here learning DSA by babbar bhai at nights while working a 9 hour shift in sales just to change my domain as my current life sucks.
    Also great content so far i'm actually learning its better to learn from here than to pay thousands to some edutech companies.
    AGAR COLLEGE MAI HO AUR YE PAD RAHE HO TOH ABHI BHI TIME HAI CODING KRLO FAEDA HAI!

  • @SahilKumar-kg5jc
    @SahilKumar-kg5jc Год назад +114

    I don't know why this dsa course is so underrated even this is far better than paid course! Bhaiya the way u explain every thing repeatedly that's awesome. Concept ese hi clear ho jata hai 😎. Thank u so much for this course.

    • @rakshithml4631
      @rakshithml4631 Год назад +3

      Hi bro I am looking for anyone with whom I can discuss and learn so can u give ur insta or linked or Gmail wtever if u wish or anyother if they read this comment coz community learning is the best way in coding

    • @shibashisdeb4136
      @shibashisdeb4136 Год назад +2

      @@rakshithml4631 Hi Rakshith! I just started this DSA course and am searching for such a group for discussions!

    • @HARSHSINGH-vs4ot
      @HARSHSINGH-vs4ot Год назад +3

      ​@@shibashisdeb4136 abhi start kiye ho kya bhai

    • @AI-dy4pcg
      @AI-dy4pcg Год назад

      @@shibashisdeb4136 me too

    • @AI-dy4pcg
      @AI-dy4pcg Год назад

      bhai tu mera roomate hai kya ?

  • @godardEM
    @godardEM 7 месяцев назад +1

    23:44 we don't actually need to reduce the amount rather we can do modulus
    int amount;
    cout > amount;
    int many = 1, note;
    switch(many){
    case 1: {
    note = amount / 100;
    amount = amount % 100;
    cout

  • @rahuldave6699
    @rahuldave6699 2 года назад +8

    Homework at timestamp:1:08:01 in python
    1 st:
    def ap(n):
    arithmatic = 3*n+7
    return arithmatic
    2nd:
    def bit(a):
    count=0
    while(a!=0):
    if(a & 1):
    count+=1
    a = a>>1
    return count
    def count(a,b):
    c = bit(a)+bit(b)
    return c
    3rd:
    def fibonaaci(n):
    f=0
    s=1
    num=0
    for i in range(2,n):
    num =s+f
    f=s
    s=num
    return s

  • @seokjinchand
    @seokjinchand 11 месяцев назад +8

    i am a third year data science student and since my major is not compsci, we were not taught core topics properly, so this serie is a little intimidating since im struggling a little with the basics,,, but im still very early as placement season doesnt start for another 6 months. i hope i am able to make great progress till the time comes. thanks for the free resources🌸

    • @gauravsinghxiia4286
      @gauravsinghxiia4286 10 месяцев назад +3

      You aren't alone who's struggling to understand new concepts or basics, we are there too😪, all the best to you and all who has started this course!! Try to study or discuss topics in group which isn't clear or have doubt🤗

    • @gauravsinghxiia4286
      @gauravsinghxiia4286 10 месяцев назад +3

      Discuss with your friends who incase started coding, if not then reach out people who knows, ask them, even I m newbie and I don't have that friends circle who knows coding and even in clg they don't teach well practicallg that y it is a bit difficult to manage😢

    • @sashavlogs24
      @sashavlogs24 10 месяцев назад +3

      hey lets connect to discuss the ques and exchange doubt bcz i hv started and its kind of difficult

    • @gauravsinghxiia4286
      @gauravsinghxiia4286 10 месяцев назад +2

      @@sashavlogs24 okayy where to contact sasha

    • @ravigodara08
      @ravigodara08 8 месяцев назад

      From which college ?

  • @gautamnaugai.iab94
    @gautamnaugai.iab94 5 месяцев назад

    1:22:52 update(a) = 5
    orginal value of a is 5
    1:22:55 update (a) = 10
    original value is 15
    1:22:57 a is 196

  • @nityachaudhary1125
    @nityachaudhary1125 Год назад +4

    maybe i m too late to these videos but trust me i saw all the videos from scratch and moving on forward ...video was just amazing..hats off to you bhaiya!! thankyou so much for making these precious videos

  • @govindsuryavanshi6653
    @govindsuryavanshi6653 Год назад +12

    First I have completed all DSA series and now conclude this is Greatest ever DSA series to exist on youtube or paid courses. Your contribution will be remembered. You're God of DSA for us🙇‍♂

    • @Shubhamkumar-tt1km
      @Shubhamkumar-tt1km Год назад +1

      hey dude can you provide us with notes of these lectures plz agr bnaye h toh kyunki starting ki kuch videos k baad notes nahi h

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

    24:50
    #include
    using namespace std;
    int main(){
    int num;
    coutnum;
    int rs100,rs50,rs20,rs1;
    switch(1){
    case 1:
    rs100=num/100;
    num = num%100;
    cout

  • @kushalhemanth7045
    @kushalhemanth7045 2 года назад +5

    Correct answer for time stamp : 23:44
    #include
    using namespace std;
    int main() {
    int amount,rs100=0,rs50=0,rs20=0,rs1=0,rem=0;
    cin>>amount;
    switch(1){
    case 1: rs100 = amount/100;
    amount=amount%100;
    cout

  • @Arshad.Sultan0312
    @Arshad.Sultan0312 2 года назад +3

    what an awesome way of teaching i am a pharmacy graduate learning coding from Love Babbar, kudos to you brother.

  • @PodcastsBhaiya
    @PodcastsBhaiya 4 месяца назад +2

    int n,a,b,c,d;
    cout

  • @harshsaxena5782
    @harshsaxena5782 2 года назад +14

    Homework 23:44
    int main() {
    int n;
    cout

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

      thanks bro

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

      why are we calculating % here?

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

      @@gamingbeastkamanager5359 bro % is used to find remainder
      Like 11%5 is 1

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

      @@abhijitkore7040 i know but why are we calculating the remainder here ?

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

      @@gamingbeastkamanager5359 because if we do 1330%100
      then it will return 30 .
      so we will perform next operation on thirty .
      now if we divide 30 by 10 we get 3 notes of 10 denominations .
      and now if we do 30% 10
      then we get 0 as reminder , so the program will be terminated.

  • @sumantadas8216
    @sumantadas8216 2 года назад +12

    I knew something in c++ basics before but after watching you video most important of the concept is cleared and I am feeling confident now. Thank you bhaiya ❤️

  • @ritikgupta7706
    @ritikgupta7706 Год назад +2

    HW 25:00
    int amount = 1330;
    int start=1;
    cout

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

      salam,man can you please elaborate me your code like why you use 1stly (/) and then % operator and start =1 always true????

  • @infernogamer52
    @infernogamer52 2 года назад +23

    COMPLETED AT 23:33
    ON 12-12-2022
    LIKED IT VERY MUCH:)
    NEXT TARGET: Lec#9 BEFORE SLEEPING⚡🌟

    • @limitedwords9020
      @limitedwords9020 Год назад +5

      No One Asked

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

      @@limitedwords9020 no one asked to you too

    • @limitedwords9020
      @limitedwords9020 Год назад +2

      @@rmy5445 and no one even asked you to reply

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

      and noone asked you to comment @@limitedwords9020

  • @049akashpathak9
    @049akashpathak9 3 года назад +14

    HW= 1-10
    2-15
    3-196

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

      saHI HAI BOSS

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

      can u please help me in question 2
      why only 15 gets printed.
      in update function we return a = a-5;
      so the answer should be 10 and 15 both

    • @devpatel3928
      @devpatel3928 2 года назад +1

      ​@@Reehan ​@Istakhar Ahmad it return but are not storing the return value in a . that's why it shows 15 . if a = update(a) is written then the return statement will be useful otherwise no meaning .

  • @khatariinsaan5284
    @khatariinsaan5284 Год назад +1

    // *All Solved - **1:06:20*
    #include
    using namespace std;
    // Find power of number
    int power(int a, int b)
    {
    if (b != 0)
    {
    return (a * power(a, b - 1));
    }
    else
    return 1;
    }
    // Find Arthmetic Progression
    int ap(int n)
    {
    return 3 * n + 7;
    }
    // Count no of 1 bits in two numbers
    int oneBitsInTwoNumbers(int n1, int n2)
    {
    int bits1 = 0, bits2 = 0;
    while ((n1 > 0) || (n2 > 0))
    {
    bits1 = bits1 + (n1 & 1);
    bits2 = bits2 + (n2 & 1);
    n1 = n1 >> 1;
    n2 = n2 >> 1;
    }
    return bits1 + bits2;
    }
    // Nth Term of Fibonnaci
    int fibonnaciNthTerm(int n)
    {
    int a = 0, b = 1, c;
    for (int i = n; i != 1; i--)
    {
    c = a + b;
    a = b;
    b = c;
    }
    return a;
    }
    // MAIN FUNCTION
    int main()
    {
    int n = 8;
    cout

  • @RohitChoudhary-cm2xm
    @RohitChoudhary-cm2xm 2 года назад +5

    25:54
    Homework Solution:
    #include
    using namespace std;
    int main(){
    int amount;
    coutamount;
    int Remainder, Rs100 , Rs50, Rs20, Rs10, Rs1;
    switch(1){
    case 1:Rs100=amount/100;
    Remainder=amount%100;
    cout

  • @yashrajput6798
    @yashrajput6798 3 года назад +9

    BEST VIDEO ON FUNCTIONS !! explained every thing in depth !! thank you so much bhaiya for giving this quality content !!
    Your explanation + this black theme is too lit

  • @202harshadyewale2
    @202harshadyewale2 10 месяцев назад

    1:07:30
    best way to solve the fibonacci series problem using function recursion:
    # include
    using namespace std;
    int febo(int number){
    int a=0;
    if (number==0||number==1)
    {
    return 1;
    }
    else{
    return (febo(number-1)+febo(number-2));
    }
    }
    int main(){
    int number;
    cout

  • @Vikram-Sharma-
    @Vikram-Sharma- 3 года назад +50

    Sir,series is going very smoothly and I'm able to understand these topics
    Thank you so much for giving this content free of cost..!❤

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

      Ansower to 1:07:10
      // Find total number of set bits in input a and b
      #include
      using namespace std;
      int countBits(int a, int b)
      {
      int count = 0;
      while (a != 0) // count untill the bits of a become 0
      {
      if (a & 1) // checking leftmost bit
      {
      count++; // if found set bit, increment count
      }
      a = a >> 1; // left shift a to check next bit in next iteration
      }
      while (b != 0)
      {
      if (b & 1)
      {
      count++;
      }
      b = b >> 1;
      }
      return count;
      }
      int main()
      {
      int a, b;
      cout > a;
      cout > b;
      cout

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

      you can solve it using only a single while loop which reduces its time complexity @@meetmakwana3427

  • @LilPokerDragon
    @LilPokerDragon 3 года назад +62

    OUTPUT ANS:-
    1) 10
    2) 15
    3) 196

    • @CSEStudent777
      @CSEStudent777 2 года назад +2

      second 15 hai kya

    • @top190
      @top190 2 года назад +2

      Mera to 10 aarha because jo function h vo value return kr rha hai baki pta ni shi h ya galat mera please help me

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

      @@CSEStudent777 haan bro..

    • @anuj_chaudhary_2430
      @anuj_chaudhary_2430 2 года назад +1

      Bhai second m error nii aayga ky ?? kyuki function ek int reurn kr ra h aur usko koi holding value bi to chahiye na usi data type ki...

    • @aditisrivastava7548
      @aditisrivastava7548 2 года назад +1

      second ka 15 kaise aya?

  • @DhrGup-uv8ww
    @DhrGup-uv8ww Год назад +1

    57:10 i

  • @top190
    @top190 2 года назад +7

    Bhaiyaa Itna Valuable course aapne banaya hai thanks fro that 100% free with full concept crystal clear I really love your videos😊😊

  • @gearmachines
    @gearmachines 3 года назад +18

    Finally, understood the functions
    Well explained with each detail.

  • @preetiprajapat536
    @preetiprajapat536 Год назад +1

    code :
    #include
    using namespace std;
    int main(){
    int amount;
    coutamount;
    switch(1){
    case 1:{
    int h=amount/100;
    amount=amount%100;
    cout

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

    The switch case question was tricky. But was a math based problem
    #include
    using namespace std;
    int main() {
    int n, x=0,y=0,z=0,a=0;
    cout n;
    switch (1)
    {
    case 1:
    x += n/100;
    n %= 100;
    cout

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

      excellent solution brother, thanks for help

  • @aasthatripathi6952
    @aasthatripathi6952 3 года назад +44

    lecture 8 ✔
    it always feel so good after learning such concepts in depth.

  • @CaptainInfiverse
    @CaptainInfiverse Месяц назад +1

    HW (25:00)
    int main(){
    int amount;
    cout amount;
    int n100, n50, n20, n1; // no. of notes
    n100 = n50 = n20 = n1 = 0; // initialize
    switch(1){
    case 1:
    n100 = amount/100;
    amount %= 100;
    if (amount == 0){break;}

    case 2:
    n50 = amount/50;
    amount %= 50;
    if (amount == 0){break;}
    case 3:
    n20 = amount/20;
    amount %= 20;
    if (amount == 0){break;}

    default:
    n1 = amount;
    break;
    }
    cout

  • @surbhishekhar2782
    @surbhishekhar2782 3 года назад +4

    • exit(1) krke.....aur hm infinite loop chlti tab control c bhi click kr skte h:)
    • void main()
    {
    int choice = 2 ;
    switch(choice)
    {
    case 1 :
    printf("In Case 1");
    break;
    case 2 :
    printf("In Case 2");
    continue;
    case 3 :
    printf("In Case 3");
    break;
    }
    }
    error aayega*********
    Error : misplaced continue
    Using continue statement in switch case will throw an error because continue statement takes control to the condition checking statement again
    ****homework
    #include
    using namespace std;
    int main() {
    int n,rem;
    coutn;
    switch(1){
    case 1: cout

  • @soumyajyotirouth5134
    @soumyajyotirouth5134 Год назад +25

    Watching this video dec17 2023 ... awesome video sir 👍😎

    • @CodeWithCuriosity
      @CodeWithCuriosity 11 месяцев назад +2

      Bro will you be my codechef partner ? if you are consistent

    • @soumyajyotirouth5134
      @soumyajyotirouth5134 11 месяцев назад +3

      @@CodeWithCuriosity i am just a beginner....if don't have a problem with that ...then we are good to go 👍

    • @Aditya-tz5pi
      @Aditya-tz5pi 11 месяцев назад

      @@soumyajyotirouth5134 hi,even i am in

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

      ​@@soumyajyotirouth5134 iam also beginner

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

      Is there space for a beginner also 🙋

  • @nobodyhere12321
    @nobodyhere12321 Год назад +1

    Babbar bhai ap kmal hu yr no one can teach and understand the students problems like u even u know the smallest problems which a freshie face in a code .

  • @zelinski3693
    @zelinski3693 Год назад +6

    For fibonacci's nth term:
    include
    using namespace std;
    int term(int n){
    int a=0,b=1;
    for(int i=1; i>num;
    if (num==1){
    cout

  • @rahulsil3827
    @rahulsil3827 2 года назад +9

    Loving this DSA series !! All the concepts are getting cleared.

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

    11 months ago
    Home work 1, 14:16
    using switch case in infinite loop , here we are using exit(0);
    there are primarily two types of exit();
    1. exit(0) which is the exit successfully which means program has run successfully and then it is terminated. i.e. program has been executed without any error or interrupt.
    2. exit(1) Exit Failure: Exit Failure is indicated by exit(1) which means the abnormal termination of the program, i.e. some error or interrupt has occurred. We can use different integer other than 1 to indicate different types of errors.
    #include
    #include
    using namespace std;
    int main()
    {
    int n;
    cin >> n;
    while(INT_MIN){
    switch (n){
    case 1: cout

  • @mdwaqar7401
    @mdwaqar7401 Год назад +6

    Answers to Last Output Questions are as follows:-
    1) 10
    2) 15
    3) 196
    Started catching up again Hope I am able to complete this Journey of becoming a Master Software Developer.

    • @anandrajdubey1873
      @anandrajdubey1873 Год назад +1

      us bro us

    • @mdwaqar7401
      @mdwaqar7401 Год назад +1

      @@anandrajdubey1873 yep Keep it going every single day. Upcoming 3 lectures will be tough as hell but interesting

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

    તમે સારું કામ કરી રહ્યાં છો 🙏
    Please keep going on 🙏
    Your concepts is easy and very effective for students 👌

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

    1:07:32
    Set Bit Program
    #include
    using namespace std;
    int setbit(int a,int b)
    {
    int c=0;
    while(a!=0)
    {
    if(a&1)
    {
    c++;
    }
    a=a>>1;
    }
    while(b!=0)
    {
    if(b&1)
    {
    c++;
    }
    b=b>>1;
    }
    return c;
    }
    int main()
    {
    int a,b;
    cin>>a>>b;
    int d=setbit(a,b);
    cout

  • @shivaniverma4266
    @shivaniverma4266 Год назад +8

    Completed !!! 24 /08/23 @2:26 am , the effort you made to create this content is inspiration for the learner

    • @Rohit45563
      @Rohit45563 Год назад +2

      26 aug @3:55
      Lec 8 ✔️

  • @Aditya_khedekar
    @Aditya_khedekar 3 года назад +77

    "BHAIYA UR THE BEST BASS EK """FEEDBACK""" THA THODA SA FREQUENCY BAD JATI VIDEOS KI TO MAJA AJJA ATTA ,THODA DARR LAGG RAHA HE PLACEMENT LAGI NAHI ISLIYE " BTW U REMIND ME OF MY PHY SIR

    • @gangsterop9034
      @gangsterop9034 2 года назад +1

      Bhai konse sem mein h?

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

      @@gangsterop9034 8th

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

      @@Aditya_khedekar revise kar rha h kya
      DSA ?
      Anyways all the best.

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

      @@Aditya_khedekar placement lg gyi??

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

      @@jaydeep_pro t€®i lag gyi kya bro?

  • @motivation_with_harsh
    @motivation_with_harsh 2 года назад +1

    // hw problem based on fibonacci Series
    //code Writtern by harsh shukla
    #include
    using namespace std;
    int Fibonacci(int n ){
    int a=0 ,b=1 ,c;
    for(int i = 2 ; i

  • @Akashkumar-fj9yf
    @Akashkumar-fj9yf 3 года назад +4

    Content quality is awesome.... .....
    I ❤ this course.
    Thanku you sir

  • @ritikapurohit1474
    @ritikapurohit1474 3 года назад +4

    We can also use GOTO statement to exit the while loop. 15:30

  • @Jeet_cuts
    @Jeet_cuts 5 месяцев назад

    23:44
    int main() {
    int amount;
    cin >> amount;
    int notes100 = 0, notes50 = 0, notes20 = 0, notes10 = 0;
    switch (1) {
    case 1:
    notes100 = amount / 100;
    amount %= 100;
    case 2:
    notes50 = amount / 50;
    amount %= 50;
    case 3:
    notes20 = amount / 20;
    amount %= 20;
    case 4:
    notes10 = amount / 10;
    amount %= 10;
    }
    cout

  • @shubhamkolar8098
    @shubhamkolar8098 3 года назад +15

    Bhaiya Hatts off to your Dedication and struggle! The way you are explaining the concepts followed by the examples is helping us to get to know the concepts much easier. Though I know the concepts I'm preparing for the placements. I have gone through each and every videos you have uploaded since from the 1st video. Keep it Bhaiya!! Once again Thanking you for such an amazing content and examples.

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

    Thank you for making such an amazing video! so far I have watched all your videos, hope I'll stick till the end of the series.

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

    //Homework 1:07:20
    // To count and sum the Total no. of set bits( 1 ) in the binary representation of two decimal inputs.
    #include
    using namespace std;
    int bits(int n)
    {
    int sum = 0;
    while (n != 0)
    {
    if (n & 1)
    {
    sum = sum + 1;
    }
    n = n >> 1;
    }
    return sum;
    }
    int main()
    {
    int a, b;
    cout a >> b;
    cout

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

    Thanku so much bhaiya for making my concepts more strong and vivid:)

  • @AmitKumar-vj1ut
    @AmitKumar-vj1ut 2 года назад +5

    Please add handwritten notes , it will help a lot, it's a humble request

  • @RANATHEBOY
    @RANATHEBOY Год назад +1

    Calculator 18.08
    #include
    using namespace std;
    int main(){
    int a,b,ope;
    cout

  • @harishparmar6350
    @harishparmar6350 3 года назад +11

    Present! Bhaiya please course ko consistent rakhe!!
    Placements aarhe hai as I'm in third year :)

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

      ruclips.net/video/zM6G0gOVP58/видео.html
      git and github tutorial

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

      Me too

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

      bro i wanted to ask you something, how can we connect?

  • @sjks6457
    @sjks6457 3 года назад +8

    BHaiya your series is going to change our future 😍 You are awesome bhaiya☺ Love from Maharashtra❤

  • @Nandanxedits
    @Nandanxedits Месяц назад +1

    You are my favourite teacher brother ❤

  • @mdwaqar7401
    @mdwaqar7401 Год назад +3

    Completed 8th Video from start to Finish with all codes solved. Can't wait to Reach video number 149 in this Series. Loving the Journey so far.

    • @dryflame738
      @dryflame738 Год назад +1

      Kaha tak pohche bhai

    • @mdwaqar7401
      @mdwaqar7401 Год назад +2

      @@dryflame738 Bhai aur kya bolu 10th Video tak hi pohucha tha. Office ka kaam and Projects change hua toh usme focus karte karte and Family problems ki wajah se wahi par chut Gaya. Yehi Lame Excuse ha. Fir shuru karna padega yaar ab 😤😤😤😤😤😤

  • @shubhamgoswami9126
    @shubhamgoswami9126 2 года назад +5

    I used to get so confused about what to paas into the fuctions and how to call it. Thank you so much for teaching this! Recently watched the video of you achiving your dream of gifting your father a brand new car, that made my day! ❤

  • @harshchawla_7
    @harshchawla_7 Год назад +1

    23:45
    #include
    using namespace std;
    int main() {
    int total_amount, left_amount;
    cout total_amount;
    left_amount = total_amount;
    switch ( 100 )
    {
    case 100 : if(total_amount >= 100) {
    int no_of_notes = total_amount/100;
    cout b;
    ans = count_setbits(a);
    ans += count_setbits(b);
    cout n;
    if(n

  • @vikramkumarvishwakarma4586
    @vikramkumarvishwakarma4586 2 года назад +8

    Efforts are increasing day by day...n I'm enjoying the series

  • @anonymus7947
    @anonymus7947 3 года назад +4

    Your videos are giving us a different level of satisfaction...The Best

  • @PrakharRastogi-o2e
    @PrakharRastogi-o2e Год назад +1

    HOME WORK solutions 🚀
    for `1:06:54` `A.P`
    solution : 👇
    `// Arithmetic Progression
    int ap(int n) {
    int ap_formula = ( 3 * n + 7);
    return ap_formula;
    }
    int main() {
    int n;
    cin >> n;
    cout 1;
    }
    return count;
    }
    int main() {
    int a, b;
    cin >> a >> b;
    int total_bits = set_bits(a) + set_bits(b);
    cout

  • @scoc55vora15
    @scoc55vora15 3 года назад +25

    ❤️ Sir, YOUR Series is Going on very Smoothly And Please Maintain This current Speed ...not to Fast Nor Too slow ; this is the optimised Speed and ALSO You are teaching every minute thing in that too with edge Cases that I Love about You And ALSO Your teaching style is Dope

    • @classroomkafanda1437
      @classroomkafanda1437 2 года назад +1

      bro how was your experience in this series
      if any suggestion pls reply to me

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

    Bhaiya I have started my career as a fresher in an org as a dotnet developer and with a hope to go to some top mnc's some day i have started this course and to be honest I have enjoyed learning till here and will work harder for the upcoming topics. Thanks for your time and efforts.

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

    15:30
    #include
    using namespace std;
    int main() {
    while(1){
    int n=2;

    switch(n){
    case 1:cout

  • @SiddharthNahar-e9b
    @SiddharthNahar-e9b Год назад +4

    normally i am kind of lazy in comenting or liking any youtube video but bro u r helping us so much by providing us with such great content that i am being forced to do so seriousy really liking your course

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

    Sir can you please provide Handwritten Notes For Every lecture as this helps to understand things and for revision as well. Thank you

  • @amarnathghosh2722
    @amarnathghosh2722 3 месяца назад

    Actually i want to thank you sir , we need teachers like you , after wasting my 2hrs of time in collage , i learn nothing and i watch your video and i understand the topic very well. instead of paying universities a high ammount , we have to pay teachers like you I will pray that you live infinity years . Thank you so much sir, literraly im out of depression , and you done this job , you push me to believe that i will go ahead in my life . love you sir .

  • @dEviL_bIsWaJiT
    @dEviL_bIsWaJiT 2 года назад +5

    Thanks a lot for this awesome content providing for free bhaiya, really hats off for u bhaiya.❤🙏🔥