Yech, sorry, but this formatting is terrible. Here's an example of what it should look like:
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();
}
And don't forget to "return 0;" at the end!
Anyway, regarding the problem you described: "op" is given a random value at the beginning of the program, before you enter any of your loops. This value is never updated after that, so it will always pick the same equation for each iteration of the loop. Perhaps if you updated the "op" variable within the second "for()" loop, you'd get a different result each time.
Code:
printf("\nYou got %d correct. That is %d!\n");
And you aren't providing variables to match the two format specifiers in this "printf()" statement.