initializer element is not constant error - help
I am working on a program that is to call many different functions from a choice menu. I been able to get many of the functions done and call from the menu except this one function. When I compile it, it gives me a initializer element is not constant. This function was actually a program we had done earlier but now using it in a choice menu program. It works and compiles just fine on it's own but when I insert in as a function it gives me this error. The entire programs is long so I am only posting part of the function I am having problems with since this is a school assignment. I get the error right at the random number generator.
Code:
int multgame(); //function name
srand(time(0));
int i;
int num1 = rand()%50;
int num2 = rand()%50;
int answer, guess, problems;
//Answer to the random numbers generated
answer = num1*num2;
//Get user input for how many problems they want to do
printf("How many problems do you want?\n");
scanf("%d", &problems);