thecoderworld
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
No Result
View All Result
  • Programming
  • Web Development
  • Best Of
    • Alternative
    • How To
    • Tech
    • AI
    • IDE
  • PC
    • Windows
    • Mac
    • Linux
  • Reviews
  • Open Source
  • Lists
  • Security
No Result
View All Result
thecoderworld
  • Programming
  • Web Development
  • Best Of
    • Alternative
    • How To
    • Tech
    • AI
    • IDE
  • PC
    • Windows
    • Mac
    • Linux
  • Reviews
  • Open Source
  • Lists
  • Security
No Result
View All Result
thecoderworld
No Result
View All Result
Home Tutorials Source Code C Programming

C Programming Tutorial – Break and Continue Statement

Ajoy Kumar by Ajoy Kumar
June 30, 2019
in C Programming
3 min read
0
Share on FacebookShare on Twitter

This is the source code from the C Programming Tutorial. In this source code, you are going to learn about Break and continue statement in a C Programming language.

It is sometimes desirable to skip some statements inside the loop or terminate the loop immediately without checking the test expression.


In such cases, we can use breakand continue statements to skip some part of the program.

break Statement

When we want to terminate the loop (for loop, while loop and do-while loop) break statement is used. Whenbreak is encountered inside any loop, control automatically passes to the first statement after the loop.

syntax of break statement

break;

Flowchart of break statement

break statement

Source code of break statement

//break statement in c programming
 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main()
{
int num;
 
printf("Enter a number \n");
scanf("%d", &num);
 
while(num <= 10){
if(num == 5){
printf("try to enter new number!!");
break;
}
 
printf("your entered number is %d \n", num);
num++;
}
} 

In C programming, break statement is also used with switch case statement.

continue statement

The continue statement skips the execution of the statement after it and takes the control through the next cycle of the loop.

syntax of continue statement

continue;

Flowchart of continue statement

continue statement

Source code of continue statement

//continue statement in c programming
 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main()
{
in i, j;
 
for(i = 1; i<=2; i++){
 
for (j = 1; j<=2; j++){
 
if(i == j)
continue;
 
printf("%d %d \n", i, j);
}
}
return 0;
} 

Tags: c programming
Previous Post

C Programming Tutorial - For Loop

Next Post

C Programming Tutorial - Switch Statement

Ajoy Kumar

Ajoy Kumar

I am an entrepreneur by heart and founder of thecoderworld. Who always follows his passion. I love writing about software, coding, open-source, technology, smartphones, tips and tricks

Related Posts

Creating Table in C
C Programming

C Programming Tutorial – Creating Table

June 30, 2019
Array Of Pointers
C Programming

C Programming Tutorial – Array Of Pointers

June 30, 2019
pointer in c programming
C Programming

C Programming Tutorial – Pointer in C

June 30, 2019

Stay Connected

  • 177 Fans
  • 41 Followers
  • 32 Followers
  • 8k Subscribers

Latest Posts

How to Install GIMP on Windows 10
Alternative

How to Install GIMP on Windows 10

December 10, 2019
Adobe Creative Cloud Alternatives
Alternative

Top 10 Adobe Creative Cloud Alternatives for Free

December 10, 2019
Top 5 Search Engines that Do Not Track You
Top Lists

Top 5 Search Engines that Do Not Track You

December 9, 2019
thecoderworld

© 2016 - 2019 thecoderworld.com

Navigate Site

  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer

Follow Us

No Result
View All Result
  • Programming
  • Web Development
  • Best Of
    • Alternative
    • How To
    • Tech
    • AI
    • IDE
  • PC
    • Windows
    • Mac
    • Linux
  • Reviews
  • Open Source
  • Lists
  • Security

© 2016 - 2019 thecoderworld.com