
Patrick B. answered 05/05/21
Math and computer tutor/teacher
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
RandomProblem(int * a)
{
a[0] = rand()%10;
a[1] = rand()%10;
}
Go()
{
srand(time(NULL));
int a[2];
int answer;
while (1)
{
RandomProblem(a);
int done=0;
while (done==0)
{
printf(" What is %d times %d ???? :> ",a[0],a[1]);
scanf("%d",&answer);
if (answer==a[0]*a[1])
{
printf(" Very Good !!!! \n");
done=1;
}
else
{
printf(" Sorry, that is incorrect, try again ....\n");
}
}
}
}
int main()
{
Go();
}