27 lines
557 B
C
27 lines
557 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<time.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
srand(time(NULL));
|
|
int ans = rand() % 100;
|
|
int guess;
|
|
|
|
for (int attempt = 0; attempt < 5; attempt++) {
|
|
printf("%d essai(s) restant(s)\n", 5 - attempt);
|
|
scanf("%d", &guess);
|
|
|
|
if (guess == ans) {
|
|
printf("Bravo, vous avez trouvé !\n");
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
if (guess > ans) printf("La réponse est - grande.\n");
|
|
else printf("La réponse est + grande.\n");
|
|
}
|
|
|
|
printf("Dommage, la bonne réponse était %d.\n", ans);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|