Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5.  
  6. int main ( int argc, char** argv )
  7. {
  8. int nombreMystere = 0, nombreEntre = 0, nombreCoups = 1;
  9. const int MAX = 100, MIN = 1;
  10.  
  11. srand(time(NULL));
  12. nombreMystere = (rand() % (MAX - MIN + 1)) + MIN;
  13.  
  14. do
  15. {
  16. printf("Quel est le nombre mystere ? ");
  17. scanf("%d", nombreEntre);
  18. if (nombreMystere > nombreEntre)
  19. {
  20. printf("C'est plus\n\n");
  21. nombreCoups++;
  22. }
  23. else if (nombreMystere < nombreEntre)
  24. {
  25. printf("C'est moins\n\n");
  26. nombreCoups++;
  27. }
  28. else
  29. {
  30. printf("Bien joue !\n");
  31. printf("Vous avez trouve en %d d'essais !\n", nombreCoups);
  32. }
  33. } while (nombreMystere != nombreEntre);
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement