Tuesday, 9 June 2015

Program to illustrate the use of the break statement


Code for Program to illustrate the use of the break statement in C++ Programming



 



 
 #include<iostream.h>
 #include<conio.h>

 /*************************************************************************//*************************************************************************///-----------------------------  Main( )  -------------------------------///*************************************************************************//*************************************************************************/

 main()
    {
       clrscr();

       cout<<"\n ********  Break Statement  *********"<<endl;

       for(int count=1;count<=10;count++)
      {
         if(count==5)
        break;

         cout<<" "<<count;
      }

       cout<<"\n\n Counting was broken at count = "<<count<<endl;

       getch();
       return 0;
    }

No comments:

Post a Comment