34 lines
603 B
C
34 lines
603 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
int main(void) {
|
||
|
int chance = 5;
|
||
|
int tent;
|
||
|
int alea;
|
||
|
srand(time(NULL));
|
||
|
alea = rand();
|
||
|
while (alea>100) {
|
||
|
alea = alea / 10;
|
||
|
}
|
||
|
for(chance = 5; chance > 0; chance = chance -1) {
|
||
|
printf("Essayer de deviner le nombre aléatoire de 0 à 100\n");
|
||
|
while (chance != 0) {
|
||
|
scanf("%d", tent);
|
||
|
if(alea == tent){
|
||
|
printf("Bravo\n");}
|
||
|
else {
|
||
|
if (alea < tent){
|
||
|
printf("c'est moins\n");
|
||
|
chance = chance - 1;}
|
||
|
else {
|
||
|
printf("c'est plus\n");
|
||
|
chance = chance - 1;}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|