Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main ( int argc, char** argv )
- {
- int nombreMystere = 0, nombreEntre = 0, nombreCoups = 1;
- const int MAX = 100, MIN = 1;
- srand(time(NULL));
- nombreMystere = (rand() % (MAX - MIN + 1)) + MIN;
- do
- {
- printf("Quel est le nombre mystere ? ");
- scanf("%d", nombreEntre);
- if (nombreMystere > nombreEntre)
- {
- printf("C'est plus\n\n");
- nombreCoups++;
- }
- else if (nombreMystere < nombreEntre)
- {
- printf("C'est moins\n\n");
- nombreCoups++;
- }
- else
- {
- printf("Bien joue !\n");
- printf("Vous avez trouve en %d d'essais !\n", nombreCoups);
- }
- } while (nombreMystere != nombreEntre);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement