C break statement



Break Statement Simply Terminate Loop and takes control out of the loop.

Break in For Loop :

for(initialization ; condition ; incrementation)
{
Statement1;
Statement2;
break;
}

Break in While Loop :

initialization ; 
while(condition)
{
Statement1;
Statement2;
incrementation
break;
}

Break Statement in Do-While :

initialization ; 
do
{
Statement1;
Statement2;
incrementation
break;
}while(condition);

Way 1 : Do-While Loop


Way 2 : Nested for


Way 3 : For Loop


Way 4 : While Loop