do-while Loop

  Рет қаралды 684,446

Neso Academy

Neso Academy

Күн бұрын

Пікірлер: 185
@sidla6989
@sidla6989 4 жыл бұрын
2:55 , i like how you noted that you need to put the semicolon after the "do...while" function while you did not use your own advice
@tatanim5048
@tatanim5048 4 жыл бұрын
😂😂😂
@sweekritakumari8954
@sweekritakumari8954 4 жыл бұрын
Exactly 😂😂😂
@sanguin3
@sanguin3 3 жыл бұрын
He actually did that "on purpose".
@karthikgunnam1102
@karthikgunnam1102 3 жыл бұрын
Same doubt bro
@shashikumar-rw1zc
@shashikumar-rw1zc 2 жыл бұрын
Right bro
@aishwarya8253
@aishwarya8253 5 жыл бұрын
Really ur explanation is great sir Even the one who do not know the c -lang by listening to this I’m sure that they’ll understand C lang clearly . Tq sir.......
@hinataaaaaaaa
@hinataaaaaaaa 9 ай бұрын
Minutes of struggle solved in seconds
@naveedsab1352
@naveedsab1352 10 ай бұрын
For (int I=o;i
@siulichatterjee3652
@siulichatterjee3652 3 жыл бұрын
Whenever he says "right?", I fear that in the very next moment he'll say ," wrong! !"😄😄
@chocolittlecrushon201
@chocolittlecrushon201 2 жыл бұрын
Printf also ; missing
@hue8362
@hue8362 2 жыл бұрын
Same
@bharathvyaas7027
@bharathvyaas7027 2 жыл бұрын
Me to
@monikamanhas717
@monikamanhas717 2 жыл бұрын
Me too🤣
@srijapotnuru3801
@srijapotnuru3801 Жыл бұрын
​@@chocolittlecrushon201is that mean the structure of programming is wrong...? I don't know just asking could you tell me please 😊
@miroslavblagoev5887
@miroslavblagoev5887 2 жыл бұрын
Thank you for the video, I just want to sat that - this code also works, uses while instead of do-while, and gives same output as your do-while loop with the same with even fewer lines. int n; while(n != 0){ printf("Enter an integer ") scanf("%d",&n); }
@zaugitude
@zaugitude Жыл бұрын
Yes, I tested this and it works. Here is the interesting thing, in the following code, the initial printf statement prints n with a value of 32764 to 32767 ( I only ran it a few times). If I comment out the while construct the printf statement then gives n a value of zero. Does the compiler see that it needs a non-zero value to make the while loop valid or what? int n; printf("n = %d ", n); while(n != 0){ printf("Enter an integer "); scanf("%d", &n); }
@miroslavblagoev5887
@miroslavblagoev5887 Жыл бұрын
​@@zaugitude in C, Static variables (file scope and function static) are initialized to zero, but non-static variables (local variables) are indeterminate. Reading them prior to assigning a value results in undefined behavior. For example, if the above is in main, n start with 0, but if you have a function, and there you use this code, you will get unpredicted values. Also note that if the value in the brackets is not true, the code below will not execute. :)
@saptadeepghosh668
@saptadeepghosh668 8 ай бұрын
For the while loop just initialize the n value with 1 before the loop starts , so it enters the loop as i>0. And you also don't need to take input before the while loop.
@Anthony-ri2vp
@Anthony-ri2vp 2 жыл бұрын
I hate this, just use a for loop
@mohamedyousufrahman4954
@mohamedyousufrahman4954 Ай бұрын
😂😂me too, same mindset
@compangit1524
@compangit1524 Жыл бұрын
Comments for myself: normal while loop is the while-do loop. Then, we have another loop which is called the do-while loop. do-while loop is used when we want to execute the body of the loop at least ONCE.
@OneBAIDEN
@OneBAIDEN Жыл бұрын
Smart
@ahmed6569180
@ahmed6569180 4 жыл бұрын
thank you for ur amazing explanation. a small note: there is a missing ';' at the last do-while example you entere.
@TheoTime-bk9fk
@TheoTime-bk9fk 11 ай бұрын
im learning c++ thanks a lot
@ksofficerofficer7858
@ksofficerofficer7858 5 ай бұрын
Every time I watch your teaching videos I'm getting better, Thank you so much
@nehagupta3668
@nehagupta3668 2 жыл бұрын
Sir 🗣️a small note: there is a missing 👉';' at the last do-while example you entere.✍️
@BTMINSiddhiChobe
@BTMINSiddhiChobe 3 жыл бұрын
On 3:55, the program of do-while , there should be a semicolon after while
@the.merciful17
@the.merciful17 3 жыл бұрын
r u sure
@Kasko-na-raja
@Kasko-na-raja 3 жыл бұрын
Same doubt
@guddititejesh5426
@guddititejesh5426 3 жыл бұрын
Ha yes.dude
@rokonalichowdhury9760
@rokonalichowdhury9760 Жыл бұрын
#include int main(void) { char ch; do { printf("Enter: "); ch = getchar(); } while (ch != 'q'); printf("Great"); } Note: It displays a single enter at the start but in the second time, it displays double enter.
@AK--vc9wd
@AK--vc9wd 3 жыл бұрын
I will learn full C from neso academy.
@danielmuibi2834
@danielmuibi2834 Ай бұрын
i love the explanation short and precise
@amandeepsinghdhillon143
@amandeepsinghdhillon143 2 жыл бұрын
My 2 hours work you solved in 2-3 minutes sir I am sure that your channel will be sure in top 10 ❤
@A_A-qe3gx
@A_A-qe3gx 4 жыл бұрын
Thank you sir for this video it's really good!!!
@UruzStrong
@UruzStrong 4 жыл бұрын
What a fantastic tutorial, I struggled with this for a long time before seeing your video. Thank you
@reshamxsk
@reshamxsk 4 жыл бұрын
Same here!
@ergoproxy3032
@ergoproxy3032 2 жыл бұрын
i like the explanation but when i removed the first printf and scanf from while loop it still works perfectly fine and as we want like this, therefore i still dont get the difference: #include int main() { int n; while(n!=0) { printf("enter integer"); scanf("%d", &n); } printf("staaaaghp"); return 0; }
@UttamKumar-dp9dp
@UttamKumar-dp9dp Жыл бұрын
Where are you writing the code? I'm using replit and this code is not working
@AspirantTD-warrior
@AspirantTD-warrior Ай бұрын
I think it's because int n; in some compilers automatically gives the value 1 and in some other automatically gives value 0, so maybe what he discussed was for initial value 0, the loop won't run, and maybe in your compiler, the initial default value is non-zero so that's why it's happening
@baohuariley5740
@baohuariley5740 6 ай бұрын
thank you so much. Now I understand difference between while and do while loop
@iqmal3910
@iqmal3910 2 жыл бұрын
Excellent explanation sir VERY HELPFUL VIDEO
@Pritamdas-bg7fp
@Pritamdas-bg7fp 6 жыл бұрын
neso academy is the best
@celestinefrancis8401
@celestinefrancis8401 2 жыл бұрын
really extraordinary
@damla13567
@damla13567 3 жыл бұрын
int b=0; int c=9; do { if(c
@kapkoder4009
@kapkoder4009 4 жыл бұрын
Thanks for the explanation, now I understand
@juanparada1319
@juanparada1319 26 күн бұрын
Better than Chat-GPT 🙌🏽
@deepakj3727
@deepakj3727 5 жыл бұрын
4.10 you missed the semicolon in do while loop's side
@sitanshuravi3328
@sitanshuravi3328 5 жыл бұрын
It is because he too didn't has used do- while much
@saulaur
@saulaur 4 жыл бұрын
I think it is @2:42 :-)
@GurmeetKaur-vi4yg
@GurmeetKaur-vi4yg Ай бұрын
Thanks sir
@jimmymesa
@jimmymesa 5 жыл бұрын
Putting a semicolon at the end is probably necessary for the compiler to parse the source code properly.
@AakashYadav-ch9un
@AakashYadav-ch9un 3 жыл бұрын
Instead of that printf and scanf function we can just simply initialise n=1 in while loop
@arunjithajith7958
@arunjithajith7958 3 жыл бұрын
But in the question user need to give the value
@asdjkk1297
@asdjkk1297 2 жыл бұрын
4:00 look at the while program . You are not terminating the scanf function
@S7VENFILM
@S7VENFILM 5 жыл бұрын
Watching you grow. Thanks for sharing
@mousaismail8757
@mousaismail8757 2 жыл бұрын
I like this method of teaching
@navkaransinghbrar4380
@navkaransinghbrar4380 6 жыл бұрын
Thats it ....I hoped u will post Programming videos.....I will watch whole of them but keep posting ....and also on java and C++
@ritikshrivastava9442
@ritikshrivastava9442 4 жыл бұрын
If somebody wants to know how to write the same program using for loop int main() { for (int i; i != 0;) { printf("enter an integer "); scanf("%d",&i); } printf("you're out of loop"); return 0; }
@brunobiega
@brunobiega 2 жыл бұрын
what does the ,,&" sign before variable ,,i" mian?
@kennardsugirotok7374
@kennardsugirotok7374 3 жыл бұрын
You are a very great teacher!
@MarcGyverIt
@MarcGyverIt 3 жыл бұрын
Your explanations are the best out there. If you have a paid course, I will sign up for it.
@saritasingh3713
@saritasingh3713 3 жыл бұрын
Thank you sir. All my doubts are cleared
@vaibhavgurav6291
@vaibhavgurav6291 3 жыл бұрын
Thank you i understand but second example your missing semicolon sir but sir thank you giving explanation.
@mdamdadulislam7669
@mdamdadulislam7669 3 жыл бұрын
I love this explanation.
@shaheersheri1
@shaheersheri1 4 жыл бұрын
Nice share keep it up
@navalkishore6559
@navalkishore6559 4 жыл бұрын
int n; printf("enter an integer"); scanf("%d",n); while(n=0) { printf("enter an integer"); scanf("%d",n); } printf("you are out of loop"); when i use this code then and entered 0 then i got message "you are out of loop". and not when [while(n!=0)]
@MdKhadeerPasha-wf6lk
@MdKhadeerPasha-wf6lk 3 жыл бұрын
Sir in example of do and while u not putted semicolon in do while loop
@francisjaranilla3335
@francisjaranilla3335 Жыл бұрын
Hello Sir! How about you make a video about turning for loop into do while loop.. It will be very helpful. Thank you!
@ratchetbear3777
@ratchetbear3777 2 жыл бұрын
Information was clear and concise. Thanks heaps for your efforts :)
@sohailsohail9164
@sohailsohail9164 2 жыл бұрын
2:41 displayed do while loop program no semi coloum
@amberarts7356
@amberarts7356 3 жыл бұрын
Thank you so much this was really helpful
@dattareddy6170
@dattareddy6170 2 жыл бұрын
I want to know what compiler you are using in your lectures
@belayfekadu
@belayfekadu Жыл бұрын
what happen if we put semi colon in after while loop
@anushabaskar
@anushabaskar 3 жыл бұрын
U told that in do while loop exactly in while statement it should be ended with semicolon right??
@muhammadfauzanazima3807
@muhammadfauzanazima3807 3 жыл бұрын
What fonts did you use in this tutorial? very interesting, I want to use it too.
@AzharAli-cr2vj
@AzharAli-cr2vj 4 жыл бұрын
great instructor
@pakistancricket245
@pakistancricket245 3 жыл бұрын
It was really helpful for me sir ❣️❣️❣️
@avunooritagore6089
@avunooritagore6089 6 жыл бұрын
Sir.. I have a doubt in Second program both while and do-while is giving same output but you said if we won't place semicolon in do-while it should give an error but it is not happening here why?
@gp_sec
@gp_sec 6 жыл бұрын
He didn't run the 2nd program...
@budigesrivishnugoud6882
@budigesrivishnugoud6882 3 жыл бұрын
🤔doesn't got any error for not using semicolon in do while???
@constantinkamgo6742
@constantinkamgo6742 3 жыл бұрын
good content ;deep and well structured.
@made432
@made432 3 ай бұрын
What are the use cases for both of these ?
@BODDEPALLILAKSHMIVARAPRASAD
@BODDEPALLILAKSHMIVARAPRASAD Жыл бұрын
Where is Semicolon after scanf statement in WHILE LOop😅
@shubhamtiwari1190
@shubhamtiwari1190 2 жыл бұрын
Sir aap jo next example diye the usme while loop k baad semicolon nhi lagye he
@672_tejasdesai3
@672_tejasdesai3 3 жыл бұрын
sir your explaination is very nice, thank you sir :)
@shauryasaxena5263
@shauryasaxena5263 3 жыл бұрын
Tq very much sir and your method is very easy
@njabznmasikane359
@njabznmasikane359 6 ай бұрын
Thanks so much!
@Roshankumar-hc1pp
@Roshankumar-hc1pp 3 ай бұрын
I didn't understand last topic. When should....?
@goldenG978
@goldenG978 3 жыл бұрын
amazing, short and accurate!!!
@srta.carlota696
@srta.carlota696 3 жыл бұрын
Thanks! It was a fast and simple explanation to understand. Nice video ^_^
@upscallmydream
@upscallmydream 3 жыл бұрын
Sir at the end you tell me the output will be the same because both the programs does same task.. but when u studied me difference between them. We used same task. But output was different.. in while loop no output but in do while loop output=0
@zaidansari3595
@zaidansari3595 6 ай бұрын
Thnx ...very helpful ;_;
@shiv_crypto_
@shiv_crypto_ 8 ай бұрын
I guess we can do same thing with both the loops as you said about that redundancy i wrote the code without seeing the answer if i am wrong in my code please correct me but its giving output that is required //C code using loop to stop user when she/he enters ) as input #include int main() { int i = 2; while(i!=0) { printf("Enter the number you want : "); scanf("%d",&i); } printf("You entred wrong digit : "); int j = 5; do{ printf("Enter the number rather than 0 only "); scanf("%d",&j); } while(j!=0); printf("You entered worng value "); return 0; }
@shivangishukla3312
@shivangishukla3312 2 жыл бұрын
4:01 why you didn't put ; on do while loop
@madhura9510
@madhura9510 4 жыл бұрын
Sir plz make vdo on difference between definition and declaration of variables in c
@heypikachu276
@heypikachu276 2 жыл бұрын
Isn't this still classified as a while loop? I honestly have no idea because I use LUA and haven't learned C fully, but thought not "While true do," it's still a while loop, correct?
@ashraf6850
@ashraf6850 4 жыл бұрын
Do while end with semicolon
@jayapriyamoorthy7443
@jayapriyamoorthy7443 2 жыл бұрын
Python oops concepts post pannunga
@jayapriyamoorthy7443
@jayapriyamoorthy7443 2 жыл бұрын
While loop is enter loop
@CantHandle777
@CantHandle777 2 жыл бұрын
isnt 0 a integer...btw nice explanation
@vilanv-a6296
@vilanv-a6296 3 жыл бұрын
so its literally another syntax to add an if statement in a loop?
@varishamalik9726
@varishamalik9726 2 жыл бұрын
Sir you didn't put colon after while in do while loop
@asif7240
@asif7240 2 жыл бұрын
thanks!
@samararora2420
@samararora2420 2 жыл бұрын
You didn't write semi colon after while in the program of do while when showing the program
@jimmymesa
@jimmymesa 5 жыл бұрын
Python is born out from C. However, there is no do-while construct in Python.
@santhoshjd2673
@santhoshjd2673 4 жыл бұрын
Thank you 😊
@ahmadnaqvi2045
@ahmadnaqvi2045 2 жыл бұрын
Why don't you have a ; after while (n !=0) in the do while loop code?
@handle_gc
@handle_gc Жыл бұрын
Because using ; after while() will consider the end of the loop (without body) and throw error. In case of do-while it assumes while() as a part of do{}. And ; separates this complete loop body n condition from rest of the statements.
@regular4993
@regular4993 2 жыл бұрын
It can also be n>0 ryt?
@Justin-yk1jk
@Justin-yk1jk 4 жыл бұрын
do nested loop in C language please
@actionaction007
@actionaction007 2 жыл бұрын
Semi colon not used in example ? Mistake
@ruok1992
@ruok1992 2 жыл бұрын
''while u r outside, buy some milk'' - he neve came back
@iltam-sumra-rashupti-elatim
@iltam-sumra-rashupti-elatim 3 жыл бұрын
thank you indiaman
@md.mominulislam4189
@md.mominulislam4189 4 жыл бұрын
Can i solve the same problem with for loop?
@abhinavkondilya9471
@abhinavkondilya9471 3 жыл бұрын
Your last Do - While loop shown error because the semi colon is missing
@anonymouscrawler.official
@anonymouscrawler.official Жыл бұрын
@diyandassembling2907
@diyandassembling2907 3 жыл бұрын
Interesting.
@cinemacandy5496
@cinemacandy5496 3 жыл бұрын
the hindi channel should mention in title as Hindi.
@harishkumar-gg6nt
@harishkumar-gg6nt 3 жыл бұрын
why your codes are not working in online complier
@peravarapulalitha2105
@peravarapulalitha2105 4 жыл бұрын
It's good 👍
@shitikanthparida8270
@shitikanthparida8270 Жыл бұрын
Bro You left the semi colon in the integer math in do while loop .
@jayapriyamoorthy7443
@jayapriyamoorthy7443 2 жыл бұрын
Do while is exit loop
@humaarif437
@humaarif437 5 жыл бұрын
what's the meaning of semicolon at the end of do while loop please dry run this loop
@sruthimajhi5610
@sruthimajhi5610 Жыл бұрын
Hey can anyone clear my doubt? We need 2 variables right coz there are 2 statements for storing an integer .
@handle_gc
@handle_gc Жыл бұрын
could you put a time stamp for much clarification for your que?
Loop Control Statements − break and continue
7:39
Neso Academy
Рет қаралды 329 М.
for and while Loops
6:49
Neso Academy
Рет қаралды 748 М.
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Call By Value & Call By Reference in C
8:34
Neso Academy
Рет қаралды 1,3 МЛН
The Do While Loop in Java
6:54
Neso Academy
Рет қаралды 127 М.
Special Programs in C − Pyramid of Stars
11:06
Neso Academy
Рет қаралды 887 М.
Loops in C++ (for loops, while loops)
12:20
The Cherno
Рет қаралды 415 М.
Conditionals (if-else, Nested if and else if)
8:10
Neso Academy
Рет қаралды 372 М.
Solve Any Pattern Question With This Trick!
57:20
Kunal Kushwaha
Рет қаралды 2,5 МЛН
While Loop Java Tutorial #37
8:51
Alex Lee
Рет қаралды 320 М.
C++ Tutorial -   Loops In C++ [For Loop, While Loop, Do While Loop]
16:20
#12: while Loop in C Programming |  C Programming for Beginners
12:23
For loops in Python are easy 🔁
5:06
Bro Code
Рет қаралды 376 М.
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН