Loop Control Statements − break and continue

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • C Programming & Data Structures: break and continue statements in C programming.
    Topics discussed:
    1) Break statement.
    2) Programming example of break statement.
    3) Continue statement.
    4) Programming example of continue statement.
    C Programming Lectures: goo.gl/7Eh2SS
    Follow Neso Academy on Instagram: @nesoacademy(bit.ly/2XP63OE)
    Follow me on Instagram: @jaspreetedu(bit.ly/2YX26E5)
    Contribute: www.nesoacademy...
    Memberships: bit.ly/2U7YSPI
    Books: www.nesoacademy...
    Website ► www.nesoacademy...
    Forum ► forum.nesoacade...
    Facebook ► goo.gl/Nt0PmB
    Twitter ► / nesoacademy
    Music:
    Axol x Alex Skrindo - You [NCS Release]
    #CProgrammingByNeso #CProgramming #breakStatement #continueStatement

Komentáře • 137

  • @hritikvasuja6250
    @hritikvasuja6250 Před 4 lety +118

    What a lecture sir.
    we cannot imagine these kind of lectures in Colleges

  • @pradipmalla8059
    @pradipmalla8059 Před 4 lety +48

    this channel deserves much more subscribes....you guys are doing really great job ..thanks alot !

  • @brockolious
    @brockolious Před 3 lety +23

    The best C Programming guide and explanations I have ever seen for beginners like me. Clear, concise explanations that we can immediately use in our own C programs. To everyone studying for exams, good luck and you'll do awesome!!!

  • @ItachiUchiha-mm5ov
    @ItachiUchiha-mm5ov Před rokem +7

    This seemed much easier for me for continue
    #include
    int main(){
    int a;
    for(a=1;a

    • @SifenAbdi-sl6lz
      @SifenAbdi-sl6lz Před 7 měsíci

      its a great thing you got going on bruh.

    • @Salamanca-joro
      @Salamanca-joro Před 4 měsíci

      What does it mean a% 2 ==0

    • @Sushilulu
      @Sushilulu Před 2 měsíci

      @@Salamanca-joro it’s division operation..if we get balance of some value number..then it will pass and not getting through the continue, as it’s basically (a%2!=0)…it’s gonna be an odd number

  • @nitishsah1060
    @nitishsah1060 Před 2 lety +6

    Sir you are taking the profession of teaching to next level such a well narrated lecture at free of cost! Thanks a lot sir

  • @noaMurcianOfficial
    @noaMurcianOfficial Před 4 lety +12

    I think that the second example is to complicated,
    i suggest this code:
    int main() {
    for (int i = 0; i < 20; i++) {
    if (i % 2 == 0) {
    continue;
    }
    printf("%d
    ", i);
    }
    }

  • @Maha_s1999
    @Maha_s1999 Před rokem +4

    Fantastic lecture! Concise and the differences between break and continue super clear!

  • @rajeevKr07
    @rajeevKr07 Před 4 lety +6

    Alternate solution using previous knowledge of while loop thank you neso academy 🙏❤
    #include
    int main()
    {
    int i;
    printf("enter an integer");
    scanf("%d",&i);
    while((i!=0)&&(i>0))
    {
    printf("enter an integer");
    scanf("%d",&i);
    }
    }

  • @sidzmhs
    @sidzmhs Před 9 měsíci +1

    Damnnnn this video cleared all my doubts!!!!! Its so simply explained, I'm impressed !

  • @sakshisrivastava7033
    @sakshisrivastava7033 Před 3 lety +3

    I have been always in doubt with this topic.. Thank you so much for this lecture

  • @ziko9762
    @ziko9762 Před rokem

    #include
    int main()
    {
    int a, b;
    printf("Enter value: ");
    scanf("%d", &a);
    for (b = 1; b

  • @tofiq62
    @tofiq62 Před 2 lety +1

    This guy tells lessons better than my university teachers!

  • @yadhuss919
    @yadhuss919 Před 4 lety +2

    I before watching this video I was confused with this topic but now I understand how easy it was

  • @tayyab.sheikh
    @tayyab.sheikh Před 8 měsíci +1

    4:55 "It simply means we won't execute the rest of the statements but we would *continue* to execute the loop"

  • @dsa3702
    @dsa3702 Před 3 lety +33

    Realizing in 2020, WAP.. is something else now 🤣🤣

  • @Codenames560
    @Codenames560 Před 4 lety +1

    Thanks - I wrote down your definition for 'Continue'.

  • @aswithasai4015
    @aswithasai4015 Před 2 lety

    Thank you very much from the bottom of my heart you don't know how much these lectures are helping like me beginners .

  • @ergoproxy3032
    @ergoproxy3032 Před rokem

    so for 0:38 i quite didn't understand the necessity of using break in this exercise since i can use only while loop without if and break, it will work exactly same like this(please correct me if im wrong):
    #include
    int main()
    {
    int n;
    printf("enter a number;)");
    scanf("%d", &n);
    while(n!=0&&n>0)
    {
    printf("enter a number ");
    scanf("%d",&n);
    }
    return 0;
    }

  • @neniscarlet3880
    @neniscarlet3880 Před 6 lety +6

    Thank you, very simple and helpful. Keep up the good work!

  • @taifX18
    @taifX18 Před 3 měsíci

    I understand the difference from you in 5 minutes!! thank you so much

  • @moeentrimzi.8532
    @moeentrimzi.8532 Před 2 lety

    #include
    int main()
    {
    int n=2;
    for(int i=1;i

  • @kunalsoni7681
    @kunalsoni7681 Před 5 lety +5

    before i really confused.. but i watch this video i understand too much . thank so lot sir😙❤😍😊

  • @prathamgond4314
    @prathamgond4314 Před 2 lety

    I thought that this channel was only for analog electronics.....I was surprised to see this

  • @ritikshrivastava9442
    @ritikshrivastava9442 Před 3 lety +2

    Same program without continue
    int main() {
    printf("printing the odd number from 0 to 20
    ");
    int i=0;
    while(i

    • @purubhargava8096
      @purubhargava8096 Před 3 lety +1

      u could have used simply i+=2 with i intiation as i = 1 use a for or while loop if occupy more space and reduce the execution time.

  • @r.ksharma2321
    @r.ksharma2321 Před 3 lety +1

    Thank you 🖤🖤🖤 so much for clearing all of my doubt easily

  • @antoniomike2972
    @antoniomike2972 Před 3 lety +1

    This is really helpful, I get it clearly now

  • @danieliniguezv
    @danieliniguezv Před 2 lety +1

    amazing explanation! thank you so much!

  • @gatecomputerscience1484
    @gatecomputerscience1484 Před 2 lety +1

    Great explanation

  • @rakshitverma3528
    @rakshitverma3528 Před 5 lety +3

    you really are amazing with your job keep it up :)

  • @joshua_dlima
    @joshua_dlima Před 4 lety +3

    Damn good explanation! Thanks sir

  • @prakharkatwal7866
    @prakharkatwal7866 Před rokem

    #include
    int main() {
    printf("Odd numbers from 1 to 20 using i += 2:
    ");
    for (int i = 1; i

  • @Make_it-Simple
    @Make_it-Simple Před 3 měsíci

    Simple & Basic 👌

  • @abdomenebadellah
    @abdomenebadellah Před 3 lety

    The Helpful Acronym..thanks,sir ❤️

  • @Hustler2025
    @Hustler2025 Před 3 lety

    I come after watching codewithharry c language.
    I got doubt between break and continue but coming here is worth it.

  • @islammostafa3037
    @islammostafa3037 Před 3 lety +1

    thank you, the best channel to simplify programming..

  • @ujjwalyadav8253
    @ujjwalyadav8253 Před 2 lety

    I like the whole content of this channel

  • @joehayden6065
    @joehayden6065 Před 2 lety

    Very clear, pedagogically rich!

  • @I_veeresh
    @I_veeresh Před rokem

    what i
    I never understand in my life ,i understand here in this particular lrecture.

  • @yehtikephyo94
    @yehtikephyo94 Před 4 lety +1

    You saved my life. Thanks for your lessons.

  • @rohan8952
    @rohan8952 Před 4 lety +1

    Very nice explanation 👌

  • @nazmapervin7198
    @nazmapervin7198 Před 4 lety +1

    Ah..now i understand it... thank u so much!!

  • @zunaedaman1930
    @zunaedaman1930 Před 2 lety

    What a lecture! My current favourite

  • @anilakokapeta9203
    @anilakokapeta9203 Před 4 lety

    I am getting successful output by writing this code for the first program:-
    #include
    void main()
    {
    int a;
    do{
    printf("Enter any number: ");
    scanf("%d",&a);
    }while(!(a

  • @GeeksPort
    @GeeksPort Před 6 lety +2

    Thank you...
    It was awesome...

  • @elcactus1159
    @elcactus1159 Před 2 lety

    thanks alot I really got help from this vidz

  • @rockstarmani
    @rockstarmani Před 4 lety

    We can also use and (&&) operator in while loop instead using if condition again right!

  • @Aabara_ka_dabara
    @Aabara_ka_dabara Před rokem +1

    neso academy can you make a video on int main and void main diffrence and why return 0

  • @arunabhachatterjee9979
    @arunabhachatterjee9979 Před 3 lety +1

    we can also use this code in continue statement same output :-
    #include
    int main()
    {
    int i;
    for (i=1; i

  • @zishan53
    @zishan53 Před 3 lety

    Osm lecture
    It is good than other platforms
    Wonderful

  • @mdzaki1844
    @mdzaki1844 Před 2 lety

    Excellent explaintion🙌🙌

  • @shubhammoudgil4408
    @shubhammoudgil4408 Před 3 lety

    one word MIND BLOWING I can't even imagine that these courses are free of cost.

  • @ictupdates
    @ictupdates Před 2 lety

    Very confusing topic made simple b neso
    fantastic😃😃

  • @GurmeetSingh-jv1un
    @GurmeetSingh-jv1un Před 5 lety +2

    thanks man!! appreciated...

  • @andistheinforitbutso7513

    Good evening 🙏

  • @charanm1773
    @charanm1773 Před 3 lety

    You are the Best

  • @frsnzri7975
    @frsnzri7975 Před 8 měsíci

    so Break and Continue is going to be executed when the condition above them is True only right?

  • @swapnilbhojwani5587
    @swapnilbhojwani5587 Před 5 lety +1

    #include
    int main()
    { int i;
    for(i=0;i

    • @sukritisood9443
      @sukritisood9443 Před 4 lety

      We can also print same by using i=i+2 in expression step of for loop

  • @avinashkumarsingh2007
    @avinashkumarsingh2007 Před 6 lety

    sir please keep uploading videos on C and data structures on a regular basis....

  • @sateelbasou9582
    @sateelbasou9582 Před 2 lety

    1:00. Why haven't you written Else after writing If inside the while loop? Isn't it is mandatory to write 'Else' if there is a 'If' ?

  • @gurucharankakaraparty4817

    I have a doubt
    In while couldn't we write while(n>0)
    Wouldn't it be the same

    • @vishallondhe7298
      @vishallondhe7298 Před 4 lety +1

      yup, but i guess he wanted to demonstrate the break statement in loop.

  • @ayushiyadav1
    @ayushiyadav1 Před 6 měsíci

    thankyouuu 💌

  • @azurehecate4882
    @azurehecate4882 Před 2 lety

    thank you sooo much

  • @harpreethundal9814
    @harpreethundal9814 Před rokem +1

    in my practical exam i saw a question which starts from WAP at that time i thought 🤔 it is out of syllabus and i did not tell to any

  • @amalfatyma3365
    @amalfatyma3365 Před 3 lety

    very easy method ....thankyou

  • @ececse
    @ececse Před rokem

    thankyou sir

  • @KaifKhan-pr5rk
    @KaifKhan-pr5rk Před 3 lety

    no need of that other equation just modulus the number if the value is 1 then odd otherwise even , continue statement can also be used for reversing the expression of the same written

  • @rufus7637
    @rufus7637 Před 2 lety

    Thank you sir!

  • @nahlaabouchakra7074
    @nahlaabouchakra7074 Před 3 lety +1

    why did you put n=n+2;

  • @yoursnoorie
    @yoursnoorie Před 2 lety

    I HAVE A DOUBT IN THIS PROGRAM N=N+2....SO WHY IT IS NOT IMPLIMENTING WHEN THE VALUE OF N=2 THE IT SHOULD BE 4 ...AND AFTER INCREMENTING IT SHOULD BE 5 SO WHERE THE THREE GOES

  • @alejofossati
    @alejofossati Před 2 lety

    Good tutorial over all but the example programs given are not the ones I would use... The one used for "continue" for example is convoluted. It's possible to do the same with a much simpler and intuitive method like checking if the reminder is 0 or not.
    IMO it would be way easier to understand if the example is a problem that actually requires the use of continue. I haven't thought of a case in which it's actually better to use continue but I'm sure there are some...

  • @WILLGYS
    @WILLGYS Před 2 lety

    Thanks man, that helped

  • @shubhamshiketd4256
    @shubhamshiketd4256 Před 6 lety +1

    Love you sir

  • @shubhangiwagh2829
    @shubhangiwagh2829 Před 3 lety

    Tysm sir

  • @memehhme
    @memehhme Před 2 lety

    Great....👏🏻

  • @rajivattri20
    @rajivattri20 Před 5 lety +1

    u r d best

  • @penguingamingDS428
    @penguingamingDS428 Před 4 lety

    due i liked it , i understood very easily , thx

  • @janvi.sharma06
    @janvi.sharma06 Před 3 lety

    Very helpful 🙏👍

  • @siddhantsingh4323
    @siddhantsingh4323 Před 3 lety

    Thanks a lot sir

  • @kranthikumar6615
    @kranthikumar6615 Před 4 lety

    Sir I have a doubt??
    If unexpectedly user hit a "character" as a input,then what happened.....
    What's the output then??????
    And explain why that is happening there!!

  • @rao9076
    @rao9076 Před 2 lety

    Sir 9

  • @khaleelshaikmohammad4759

    Sir I have a small doubt. Why to write if statement inside the while Loop. Instead we can directly write while(n>0). Can you plz reply me 🙏🙏.

  • @true4189
    @true4189 Před 3 lety

    Thank u

  • @mohamedsanoob.k1116
    @mohamedsanoob.k1116 Před 6 lety

    thanku for this video neso acadamy

  • @patchavavengalraovengalrao3784

    for even numbers if we remove continue statement in second case...then what is the use of " if " statement????

  • @rohitnakkina2393
    @rohitnakkina2393 Před 3 lety +1

    simply fantastic!!

  • @rudrapratapsingh1048
    @rudrapratapsingh1048 Před 3 lety

    i have a doubt
    that when 4 will come than how i==n statement is true(because in upper statement we declared n=2) so it will be 4==2 which is not true
    plz explain someone

  • @Vish_0910
    @Vish_0910 Před rokem

    I love your voice😍

  • @kavithapriyacj4868
    @kavithapriyacj4868 Před 4 lety

    Hatsoff 🙏👍

  • @JKSmith-qs2ii
    @JKSmith-qs2ii Před 4 lety

    if you break in a loop that is already in a loop, does it just continue the outer loop? Aka if break is in loop 1 which is in loop 2, does a break cause loop 2 to function again without finishing loop 1?

  • @anuragmukherjee705
    @anuragmukherjee705 Před 2 lety

    legendary

  • @kavithapriyacj4868
    @kavithapriyacj4868 Před 4 lety

    Please add complete.computer networks lectures please sir

  • @kritisrivastava6451
    @kritisrivastava6451 Před 4 lety

    In first program can we use this condition-
    If(n!=0||n>0) {
    printf ("Enter a no.");
    scanf("%d",&n);
    }
    else
    break;
    }

    • @srikakulam9081
      @srikakulam9081 Před 3 lety

      Yes you are right but using if else statement as you said we can take input value one time only..
      We use if inside while we can enter positive number number of times. This example is given in this video..

  • @Hiyori___
    @Hiyori___ Před 3 lety

    To print the odd numbers I created a program using the modulus operator. It gave me the same result but took 0.359 seconds while your program took only 0.141 seconds.

  • @patrickdaly7876
    @patrickdaly7876 Před 2 lety

    is this used alot, i have a feeling this is a bit of a lousy programming style, couldnt both of these commands be executed just by changing the syntax of the loops a bit?

  • @dhruvpaglet2695
    @dhruvpaglet2695 Před rokem

    2022

  • @jjo_02
    @jjo_02 Před 3 lety +1

    Ella kazhyangalum Naveenu correct aayit paranju kodukanam ketto anna..... Naveene nee padikk👍😬

  • @SifenAbdi-sl6lz
    @SifenAbdi-sl6lz Před 7 měsíci +1

    am stuck on the fact WAP means "WRITE A PROGRAM"

    • @taifX18
      @taifX18 Před 3 měsíci

      If you didn’t say that, I wouldn’t know LOL😢

  • @dhruvpaglet2695
    @dhruvpaglet2695 Před rokem +1

    Hi

  • @thripthi5298
    @thripthi5298 Před 2 lety

    Why am I getting output as 2345....1920🥺