DEV/DEV1.1/TP05/devinette.c

31 lines
442 B
C
Raw Normal View History

2022-10-04 17:30:38 +02:00
#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;
}