icp/oer/courses/c-newcomers/sections/02-dice/03-multible-rolls/program.c

22 lines
373 B
C

#include <stdio.h> // printf
#include <stdlib.h> // rand and srand
#include <time.h> // time
int roll_dice()
{
return (rand()%6)+1;
}
int main()
{
srand(time(0));
// we don't care about the decimal places
int Average = 0;
// TODO: execute this 100 times and calculate the average;
int value = roll_dice()+roll_dice();
printf("The average is %d", Average);
}