Created
January 29, 2014 09:44
-
-
Save Yago/95f86be5c4dcf795ef68 to your computer and use it in GitHub Desktop.
C - Boucle
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
// While ////////////////////////////////////////////////////////////////// | |
/* while = tant que */ | |
int nombreEntre = 0; | |
while (nombreEntre != 47){ // Tant que l'utilisateur ne tape pas 47 | |
printf("Tapez le nombre 47 ! "); | |
scanf("%d", &nombreEntre); | |
} | |
ou | |
int compteur = 0; | |
while (compteur < 10){ // Tant que le compteur est en dessous de 10 | |
printf("Salut les Zeros !\n"); | |
compteur++; | |
} | |
// Do/while ////////////////////////////////////////////////////////////////// | |
/* S'execute au moins une fois avant de checker le condition */ | |
int compteur = 0; | |
do { | |
printf("Salut les Zeros !\n"); | |
compteur++; | |
} while (compteur < 10); //\\ Ne pas oublier le point virgule !!! | |
// For /////////////////////////////////////////////////////////////////////// | |
/* A besoin de plusieurs param?tre */ | |
int compteur; | |
for (compteur = 0 ; compteur < 10 ; compteur++){ // 1.vinitialisation, 2.condition et 3.incr?mentation | |
printf("Salut les Zeros !\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment