explain the break statement - computer


Explain the Break Statement - Computer Programming?

The break statement is used as an interrupt to the normal flow of control this statement causes as exit from the switch statement. It can be used within a while, for, do - while or switch statement and the break statement causes the control to come out of the entire loop. A break within a loop must always be protected within an if statement which provides the test to control the exit condition.

char ch;

ch=getchar();

switch(ch)

{

case 'a' :

case 'e' :

case 'i'  :

case 'o'            :

 case 'u'            :{

printf("Vowel");

break;

}

default :{

printf("Not a vowel");        

break;

 }

}

If the input take place to be 'a' or 'e', 'i', 'o', 'u' , the control goes to that particular case and prints "Vowel". By executing the break statement can't will come out of the loop.

Request for Solution File

Ask an Expert for Answer!!
Application Programming: explain the break statement - computer
Reference No:- TGS0304264

Expected delivery within 24 Hours