title: Dice Programm in C
body: <p>I'm having some trouble with my homework and I hope someone can help me with it.
  They want me to create a dice game with the following requests:</p>
  
  <ul>
  <li>5 dice are rolled.</li>
  <li>Grand is what you get by rolling 5x the same number</li>
  <li>Poker for 4x the same number</li>
  <li>Full House for getting 3x the same number and another 2 with the same number aswell. example:(5,5,5,2,2)</li>
  </ul>
  
  <p>I have written a code in which i can get some of the requests done. But I also have to save the values as an array which causes me alot of trouble. Can someone please show me how it is done? and explain it aswell? This is my code so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  
  int main () {
  
  srand (time(0));
  
  
  
  int dice[5];
  int i;
  
      printf ("Program dice\n");
  
      for (i=0; i&lt;5; i++)
      dice [1] = (rand ()%6 )+ 1;
      printf ("Würfel 1: %d \n", dice [1]);
  
  
      dice [2] = (rand ()%6 )+ 1;
      printf ("Würfel 2: %d \n", dice [2]);
  
  
      dice [3] = (rand ()%6 )+ 1;
      printf ("Würfel 3: %d \n", dice [3]);
  
  
      dice [4] = (rand ()%6 )+ 1;
      printf ("Würfel 4: %d \n", dice [4]);
  
  
      dice [5] = (rand ()%6 )+ 1;
      printf ("Würfel 5: %d \n", dice [5]);
  
      for(i = 0; i &lt; 6; i++)
  
  if (dice [i] == 5)
  {
      printf ("You've won! Grand!");
      return (0);
  }
  else
  {
      printf ("You lost.");
      return (0);
  }
      return 0;
  }
  
  </code></pre>