I do not know whether this question should be asked or not but I am confuse. This is reason reason I am asking here.
I wanted to know how do we use while Loop in c language I wrote program and read about while loop in my book.
I thought I should write my own programs
so, I made some examples for while loop
I think all these examples are correct but I am not sure weather its false or true. I just want to know, Am I getting right point about while loop. Is all these examples correct? Do I need to improve example for "while loop"?
I wanted to know how do we use while Loop in c language I wrote program and read about while loop in my book.
I thought I should write my own programs
so, I made some examples for while loop
- Keep light On until user closes it
- Enter password until the user enters correct password
- Do not stop the machine until its temperature is 30* c
- Fill the water in the bottle until it is empty
- Play the songs until the user stop it
Code:
while ( user doesn't close it)
{
Keep light On ;
}
while ( user doesn't enters correct password)
{
promote user to enter correct password repeatedly
}
while (temperature is 30* c)
{
run the machine continuously
}
while (bottle is empty)
{
fill water in bottle contentiously
}
while ( user doesn't stop)
{
play all songs repeatedly
}
I think all these examples are correct but I am not sure weather its false or true. I just want to know, Am I getting right point about while loop. Is all these examples correct? Do I need to improve example for "while loop"?
Last edited: