1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| LANGAGE C
#include <mylib.h>
#include <stdio.h>
#include <stdlib.h>
long int nombre1 = 0 ;
long int nombre2 = 0 ;
long int resultat = 0 ;
long int proposition = 0 ;
long int nbressais ;
const long MAX = 20 , MIN = 0 ;
int main()
{
cls (BLEU);
gotoxy (1, 1); printf ("%45s", "DEVOIR 4");
gotoxy (2, 1); printf ("%45s", "========");
nbressais = 1;
randomize();
do{
nombre1 = (rand() % (MAX - MIN + 1));
nombre2 = (rand() % (MAX - MIN + 1));
resultat= nombre1 * nombre2;
gotoxy (4, 1);printf("%ld X %ld = ",nombre1,nombre2);
lire_long_int (&proposition, 4, 11, 4, 0, 400);
if(resultat == proposition){
nbressais = nbressais + 1 ;
gotoxy (5, 2);printf("BRAVO LA REPONSE EST CORECTE \n");
}
else{
nbressais = nbressais + 1 ;
gotoxy (5,2);printf("Non la reponse correcte est %ld \n", resultat);
}
}while (!(nbressais >5));
system("PAUSE");
return 0;
} |