how can I make a random arithmetic? example 3+2,10+3,5-3 and also i want the answer not to be less than 0 and greater than 20...btw the file extension is .C..
Hope you'll answer this! tnx :)
C program! help!!?
don't know c so i can't give you code but i can do it logically:
create two random numbers 0 - 10;
then biggerNumber (randomly choose add or subtract) smallerNumber
the answer will never be more than 20 and it can never be negative cause no matter what, your subtracting a smaller from a bigger (or the same value which is 0)
Reply:int a;
int b;
b = rnd() % 10;
a = b + rnd() % 10;
printf("%d - %d = %d\r\n", a, b, a-b);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment