Puedes seguirnos en

BUSCADOR

Engineering

Break and Continue Statements in Programming C

Break statement: The break statement is used to break control in the loops. Or in general statement it is used to break the sequence. In switch case, break is used to break control of switch it self when the selected case gets executed.

EXAMPLE OF BREAK

  #include<stdio.h>
void main()
{
    int num1,num2,sum;
    int option;
switch(option)
 {                        case 1:
                                sum=num1+num2;
                                break;
                          case 2:
                                sum= num1 * num2;
                                break;
}
}

 

Continue statement: The continue statement is used to transfer the control in the beginning of loop. Whenever the continue statement is encountered immediately the control passes to the beginning of the loop. Continue is generally used with if-else statement.

EXAMPLE OF CONTINUE

#include <stdio.h>
int main ()
 {
 int a = 10;
 do
 {
 if( a == 15)
 {
 a = a + 1;
 continue;
 }
 cout << "value of a: " << a << endl;
 a = a + 1;
 }while( a < 20 );
return 0;
 }

Anuncio publicitario
Escrito por

Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.

Publicidad

ARTÍCULOS RELACIONADOS

Ciencia y tecnología

Desde hace algunos días tenemos disponible para su instalación el nuevo sistema de Google, Android 4.3. Por el momento los primeros terminales en recibir...

Linux

Cool Reader es un visor de e-book compatible con una larga serie de formatos de documentos. Cuenta con una paleta personalizable, cambio de formato...

Ciencia y tecnología

Instale shotcut Video Editor en Ubuntu 13.04, 12.04, 12.10  Este tutorial sencillo y breve le mostrará cómo instalar Vídeo Editor shotcut en Ubuntu. Shotcut...

Ciencia y tecnología

PhotoFilmStrip es una estupenda herramienta para todos los públicos, en la que en pocos pasos podemos pasar nuestras fotografías a vídeo. Veamos su manejo...