Created
October 16, 2012 04:30
-
-
Save travisperson/3897243 to your computer and use it in GitHub Desktop.
Roll Dice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
void roll(int dice[5]) | |
{ | |
int i =0; | |
for ( i = 0; i < 5; i++ ) | |
{ | |
dice[i] = rand() % 6 + 1; | |
} | |
} | |
int main () | |
{ | |
int d[5] = {0}; | |
int i =0; | |
roll (d); | |
for ( i = 0; i<5; i++) | |
{ | |
printf("%d. %d\n", i+1, d[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment