Break Statement in C language

Break Statement in C language:

(1) The break statement enables a program to skip over part of the code. A break statement terminates the smallest enclosing while, do-while, for or switch statement. Execution resumes at the statement immediately following the body of the terminated statement.

(2) Sample C language code and its output, as shown:

Sample C language code for Break Statement
#include <stdio.h>
#include <conio.h>
//BREAK Statement
int main()
{
int x;
 
for (x = 0; x < 20; x++)
  {
if (x == 15) {  //exit from loop when x = 15
break;
    }
printf(“%d\n”, x);
  }
 
getch();
return 0;
}

(3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.

click on build button for break statement in C

(4) After building the code, press the “Run” button, as shown.

run the break statement in C

(5) After pressing the “run” button, the output screen is opened, as shown.

break statement outpurt screen in C

Use of LEN Function in SQL
Use of DATALENGTH Function in SQL
LEFT (Transact-SQL)– Microsoft Docs
How to Create Connection between Excel and SQL database
Take Database Backup via SQL Query in SQL Server

Leave a Reply