You already have:
main
is a function.
if you are trying to move
x = rand() % 6 +1 ;
into a separate function, then try this:
int GetRandomNumber()
{
return rand() % 6 + 1;
}
int main()
{
int x;
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
x = GetRandomNumber();
printf("random number %d \n ", x);
return 0;
}