Syntax:-
{
if(condition)
break;
}
Flow chart:-
* Write a program to use break statement.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
printf("enter n value:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i==5)
break;
printf("%d\n",i);
}
getch();
}
|
Output:-
__________________________________________________
_____________________________________________________
______________________________________________________
_____________________________________________________
___________________________________________________
Post a Comment