Created
December 15, 2016 14:21
-
-
Save jeffotoni/653100d34e4ebbe5e725bfb6e0cc5ac6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @abstract: Brincando com continue | |
* @jeffotoni | |
* @exemplo triangulo de pascal | |
* @date: 2016 | |
*/ | |
#include <stdio.h> | |
int main(){ | |
int i,j,jj = 0; | |
puts("\n\n\033[1;35m #### Apresentando continue no for #### \033[0m"); | |
puts("\033[1;35m #### condicao de parada do for == 0,1,2,3,4 stop #### \033[0m"); | |
for(i = 0; i < 5; i++){ | |
///tudo que for par pula | |
if(i % 2 == 0) | |
continue; | |
printf("\nImpar = i:%d : Contador => j:%d", i, j); | |
j++; | |
} | |
i = 0 , j = 0; | |
puts("\n\n\033[1;35m #### Apresentando continue no while #### \033[0m"); | |
puts("\033[1;35m #### condicao de parada do While == 0,1,2,3,4,5 stop #### \033[0m"); | |
while (i < 5) | |
{ | |
i++; | |
///nao deixar executar o codigo | |
///abaixo se o resto da divisao for zero | |
///ira ocultar 0, 2, 4 | |
if(i % 2 == 0) | |
continue; | |
///ira mostrar 1, 3, 5 | |
printf("\nImpar = i:%d : Contador => j:%d", i, j); | |
j++; | |
} | |
i = 0 , j = 0; | |
puts("\n\n\033[1;35m #### Apresentando continue no dowhile #### \033[0m"); | |
puts("\033[1;35m #### condicao de parada do do while faca enquanto for verdadeiro #### \033[0m"); | |
do { | |
i++; | |
///todo resto == 0 pula, nao faz nada embaixo | |
if(i % 2 == 0) | |
continue; | |
///condicao de parada | |
if(i == 5) | |
break; | |
printf("\nImpar = i:%d : Contador => j:%d", i, j); | |
j++; | |
} while (jj == 0); | |
puts("\n\n\033[1;35m #### @@@@@@@@@@@@@@ fim @@@@@@@@@@@@@@ #####\033[0m\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment