31 lines
442 B
C
31 lines
442 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <time.h>
|
||
|
int main(void){
|
||
|
srand(time(0));
|
||
|
int x = (rand()%(100-0+1))+0;
|
||
|
int y = 0;
|
||
|
int i;
|
||
|
for(i=0;i<5;i++) {
|
||
|
printf("renter un chiffre entre 0 et 100:");
|
||
|
scanf("%d",&y);
|
||
|
if (y==x){
|
||
|
i=5;
|
||
|
printf("Bon nombre");
|
||
|
}
|
||
|
else{
|
||
|
if(y<x){
|
||
|
printf("+ \n");
|
||
|
}
|
||
|
else {
|
||
|
printf("- \n");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (y!=x) {
|
||
|
printf("le bon nombre est %d",x);
|
||
|
}
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|