Break and Continue statements in c language.

    ■》  Break statement ->     
 
                                                 It is used for take  control out of loop in a program. 

■》program->

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=1; i<=5; i++)
{
 if(i==3)
 break;
 printf("%d\n",i);
}
getch();
}

■》 Output->

1
2

---------------‐---‐------------------------------------------------------
 
        ■》  Continue statement->   

It is used for skipping  a particular part in program. 

■》 Program->

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=1; i<=5; i++)
{
 if(i==3)
 continue;
 printf("%d\n",i);
}
getch();
}

■》 Output->

1
2
4
5


Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.