CM304
CM304
ANDHRA PRADESH
Name of the faculty : V.Rajendra Prasad.
Designation : Lecturer.
Branch : Computer Engineering
Institute : V.K.R & V.N.B Polytechnic, Gudivada
Year/Semester : III Semester
Subject : UNIX & C
Subject Code : CM-304
Topic : Understand repetitive structures.
Duration : 50 Min
Sub Topic : Break and continue statements..
Teaching Aids : Diagram and animations, PPTs.
CM304.52TO53 1
Objective
CM304.52TO53 2
Recap
Loop statements
While loop
Do-while loop
For loop
CM304.52TO53 3
break and continue statements
Break statement:
CM304.52TO53 4
Flowchart for of break statement
Enter input loop
Loop false
condition
true
loop
statement
CM304.52TO53 5
Simple program using break
#include<stdio.h>
main( )
{
int n;
printf (“Enter the number”);
scanf (“%d”, &n);
while (n<10)
{
if (n==3)
{
printf(“ using break statements”);
break;
}
printf(“number =%d \n”,n);
}
}
CM304.52TO53 6
continue statement
CM304.52TO53 7
Flowchart for of continue statement
Enter the loop
true
statement
Yes
continue
No
statement
CM304.52TO53 8
Simple program using continue
#include<stdio.h>
main( )
{
int marks , i=1,sum=0;
clrscr( );
while(i<=10)
{
printf (“Enter the marks”);
scanf (“%d”,&marks);
if (marks<0|| marks>100)
continue;
sum= sum + marks;
i=i+1;
}
}
CM304.52TO53 9
Difference between break and continue
BREAK CONTINUE
Exit from
form the loop It will skip the current
immediately. iteration and begin the
next iteration of the
loop.
syntax is break; Syntax is continue;
CM304.52TO53 11
Quiz
CM304.52TO53 12
Quiz
CM304.52TO53 13
Quiz
CM304.52TO53 14
Quiz
CM304.52TO53 15
Quiz
3. continue is used to..?
a) used to skip some set of
instructions
in the loop.
b) used to execute continuously the
entire loop.
c) none of the above.
CM304.52TO53 16
Quiz
3. continue is used to..?
a) used to skip some set of
instructions
in the loop.
b) used to execute continuously the
entire loop.
c) none of the above.
CM304.52TO53 17
Quiz
CM304.52TO53 18
Quiz
CM304.52TO53 19
Frequently Asked Questions
CM304.52TO53 20