Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.94 KB | None | 0 0
  1. #include <stdio.h>
  2. int main (void)
  3. {
  4.  
  5. int J1Pion1,J1Pion2,J1Pion3,J1Pion4,J1Pion5;
  6. int J2Pion1,J2Pion2,J2Pion3,J2Pion4,J2Pion5;
  7. int i;
  8. int t;
  9. int trouver;
  10.  t=10;
  11.  trouver=0;
  12.  printf("Entrez J1Pion1:");
  13.  scanf("%d",&J1Pion1);
  14.  while((J1Pion1<1 || J1Pion1>4))
  15.   {
  16.     printf("Commande incorrecte.Réecrire J1Pion1 :\n");
  17.     scanf("%d",&J1Pion1);
  18.   }
  19.  printf("Entrez J1Pion2:");
  20.  scanf("%d",&J1Pion2);
  21.  while((J1Pion2<1 || J1Pion2>4))
  22.   {
  23.       printf("Commande incorrecte.Réecrire J1Pion2 :\n");
  24.  scanf("%d",&J1Pion2);
  25.   }
  26.  printf("Entrez J1Pion3:");
  27.  scanf("%d",&J1Pion3);
  28.  while((J1Pion3<1 || J1Pion3>4))
  29.   {
  30.      printf("Commande incorrecte.Réecrire J1Pion3 :\n");
  31.      scanf("%d",&J1Pion3);
  32.   }
  33.  printf("Entrez J1Pion4:");
  34.  scanf("%d",&J1Pion4);
  35.  while((J1Pion4<1 || J1Pion4>4))
  36.   {
  37.      printf("Commande incorrecte.Réecrire J1Pion4 :\n");
  38.      scanf("%d",&J1Pion4);
  39.   }
  40.  printf("Entrez J1Pion5:");
  41.  scanf("%d",&J1Pion5);
  42.  while((J1Pion5<1 || J1Pion5>4))
  43.   {
  44.      printf("Commande incorrecte.Réecrire J1Pion5 :\n");
  45.      scanf("%d",&J1Pion5);
  46.   }
  47.  printf("Entrez les valeurs de J2:\n");
  48.    while(J2Pion1!=J1Pion1  || J2Pion2!=J1Pion2 || J2Pion3!=J1Pion3 || J2Pion4!=J1Pion4 || J2Pion5!=J1Pion5 )
  49.  {if(t>0)
  50.   {
  51.    printf("Entrez J2Pion1:");
  52.    scanf("%d",&J2Pion1);
  53.    while((J2Pion1<1 || J2Pion1>4))
  54.    {
  55.     printf("Commande incorrecte.Réecrire J2Pion1 :\n");
  56.     scanf("%d",&J2Pion1);
  57.    }
  58.    if(J2Pion1 != J1Pion1)
  59.    {
  60.      printf("C'est faux\n");
  61.    }
  62.    else
  63.    {
  64.      (printf("C'est bon !\n"));
  65.    }
  66.    printf("Entrez J2Pion2:");
  67.    scanf("%d",&J2Pion2);
  68.    while((J2Pion2<1 || J2Pion2>4))
  69.    {
  70.       printf("Commande incorrecte.Réecrire J2Pion2 :\n");
  71.       scanf("%d",&J2Pion2);
  72.    }
  73.    if(J2Pion2 != J1Pion2)
  74.    {
  75.       printf("C'est faux\n");
  76.    }
  77.    else
  78.    {
  79.      (printf("C'est bon !\n"));
  80.    }
  81.    printf("Entrez J2Pion3:");
  82.    scanf("%d",&J2Pion3);
  83.    while((J2Pion3<1 || J2Pion3>4))
  84.    {
  85.       printf("Commande incorrecte.Réecrire J2Pion3 :\n");
  86.       scanf("%d",&J2Pion3);
  87.    }
  88.    if(J2Pion3 != J1Pion3)
  89.    {
  90.       printf("C'est faux\n");
  91.    }
  92.    else
  93.    {
  94.      (printf("C'est bon !\n"));
  95.    }
  96.    printf("Entrez J2Pion4:");
  97.    scanf("%d",&J2Pion4);
  98.    while((J2Pion4<1 || J2Pion4>4))
  99.    {
  100.       printf("Commande incorrecte.Réecrire J2Pion4 :\n");
  101.       scanf("%d",&J2Pion4);
  102.    }
  103.    if(J2Pion4 != J1Pion4)
  104.    {
  105.       printf("C'est faux\n");
  106.    }
  107.    else
  108.    {
  109.      (printf("C'est bon !\n"));
  110.    }
  111.    printf("Entrez J2Pion5:");
  112.    scanf("%d",&J2Pion5);
  113.    while((J2Pion5<1 || J2Pion5>4))
  114.    {
  115.      printf("Commande incorrecte.Réecrire J2Pion5 :\n");
  116.      scanf("%d",&J2Pion5);
  117.    }
  118.    if(J2Pion1 != J1Pion1)
  119.    {
  120.      printf("C'est faux\n");
  121.    }
  122.    else    
  123.    {
  124.     (printf("C'est bon !\n"));
  125.    }
  126.    t--;
  127.    printf("Il reste %d tentative(s)\n",t);
  128.   }
  129.   else
  130.   {
  131.     trouver=1;
  132.         printf("Vous n'avez plus de tentatives\n");
  133.   }
  134.  }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement