C Program using break and continue in do while loop

Опубликовано: 25 Декабрь 2013
на канале: code
2,831
3

www.python4cbse.com for C Programs
Hello welcome to c Programming
In this video we will see how to use break and continue statements.
Break and continue statements are use within a loop.
Here we have a program.
Let us work on the program.
At the top you can see I have included the standard header files.
Stdio.h and conio.h
This header files are required in all most all the programs.
Because we are using printf() scanf().
and printf() scanf() is defined in stdoi.h
and getch() clrscr() are defined in conio.h
here we have an integer variable n.
and clrscr() is used to clear the screen.
we have loop, and it it is do loop.
you can see the starting and ending of the loop.
do loop in the sense, do while loop.
in while we have the exit condition.
this condition decides when to exit out of the loop.
irrespective of the condition, the program flow will enter
into the loop at least once.
rest depends on the condition given in the while.
do while loop is an exit controlled loop,
because the checking is done at the exit part.
the loop will exit when you enter 0
that is the condition given in while
inside the loop,
the first statement is printf()
and scanf()
user is asked to enter a number by printf()
and scanf() will read the value.
and the value will be stored into the variable n.

after that we have one if statement here
it check for n less than zero
then execute break statement
so if negative value is entered, exit out of the loop.

if n is great than ten print skip the value
and continue statement is executed.
that is it will take the control back to the beginning of the do loop
by ignoring the rest of the code.



if both if conditions are false, then
the print given at the bottom will be executed.

if the values are between 0 and 11
the number will be printed
if the value of n is negative then exit

if the value of n is grater than 10 then don't print the number
entered by the user.

this is the way we can use break
and continue statements

this is applicable for the other loops
the for loop and while loop.

please do try the program in your compiler.

and like video
and subscribe the channel for
more videos.


Смотрите видео C Program using break and continue in do while loop онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь code 25 Декабрь 2013, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,831 раз и оно понравилось 3 людям.