DO NOT MISS

Ads

Thursday, 4 August 2016

C-Programs Using Break Statement


It is a keyword which is used to ends the loop.

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:-
__________________________________________________
_____________________________________________________
______________________________________________________
_____________________________________________________
___________________________________________________

Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims