#include // printf #include // rand and srand #include // time // TODO: parameterise this int roll_dice() { return (rand()%6)+1; } int main() { srand(time(0)); // we don't care about the decimal places int Average = 0; for (int i = 0; i < 1000; i++) { // TODO: use a D20 and a D8 int Value = roll_dice()+roll_dice(); Average = Average + Value; } Average = Average/1000; printf("The average is %d", Average); }