when I compile this code, I see same equation keep repeating. I need to get different equations that the user has requested and at the end to loop it and get what is correct out of total requested problems i.e 3/5. I can't figure out to get the percentage of what they got too. Please help.thanks.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<time.h>

int main(void){
int count=1 , times=1, x, number;
int num1, num2, op;
float answer, answer2 = 0;

srand(time(0)); op = rand()%4;
num1 = rand()%101-50;
num2 = rand()%101-50;

printf("Welcome, how many problems would you like?\n");
scanf("%d",&x);
for (times; times <= 1; times += 1) {
for (count; count <= x; count += 1) {
printf("Here is the random problem number %d \n", count);

if(op == 0) /*this is where the operations start*/
{
answer = num1 + num2;
printf("%d + %d=?\n\n", num1, num2);
printf("\nAnswer:");
scanf("%f", &answer2);
}
else if (op == 1)
{
answer = num1 - num2;
printf("%d - %d=?\n\n", num1, num2);
printf("\nAnswer:");
scanf("%f", &answer2);
}
else if (op == 2)
{
answer = num1 * num2;
printf("%d * %d=?\n\n", num1, num2);
printf("\nAnswer:");
scanf("%f", &answer2);
}
else if (op == 3)
{
answer = num1 / num2;
printf("%d / %d=?\n\n", num1, num2);
printf("\nAnswer:");
scanf("%f", &answer2);
}
}
while (answer != count) {
printf("\nYou got %d correct. That is %d!\n");
scanf("%f", &answer);
}
}
getchar();
}