icp/oer/courses/c-newcomers/sections/02-dice/01-dice/program.c

16 lines
363 B
C

#include <stdio.h> // printf
#include <stdlib.h> // rand and srand
#include <time.h> // time
int main()
{
srand(time(0)); // seeding the random number generator with the current time
// TODO: add some computation to restrict Number to 1-6
// Because a dice has only whole numbers, we use int
int Number = rand();
printf("You rolled a %d", Number);
}