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
| #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
/* déclarations */
int i;
int ch49,ch3,ch3_1,ch3_2,ch3_3;
srand(time(NULL));
/* boucle pour 2 tirages, */
for (i=0;i<2;++i)
{
/* Nb de 1 a 49 */
ch49 = rand () % 49;
/* Nb de 1 a 49 */
ch3 = rand () % 49;
/* affichage */
printf ("**************************************** TIRAGE*************************************************** No %d:\nNb hazard de 1 a 49: %d\nNb hazard de 1 a 49: %d\n",i+1,ch49+1,ch3+1);
printf ("**************************************** **************************************************")
/* test pour voir si 1 et 49 sont bien pris en compte */
if (ch49+1==49 || ch49+1==1)
{
printf("\n* TOUVE %d au tirage: %d *\n",ch49+1,i+1);
system ("pause");
}
}
system("PAUSE");
return 0;
} |
Partager