English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how can i create a program that randomly add or subtract a number? example 3+2 or 10-3, i want the operation to be random...I already figure out the numbers, this is my only problem and that is to randomize the addition and subtraction operation...
btw the file extension is .c...tnx help you could help me... :)

2007-12-19 23:06:03 · 2 answers · asked by AngryProgrammer 1 in Computers & Internet Programming & Design

2 answers

Have a random number between 0 and 1.
If 0 then add
else subtract.

Don't make it any more complicated.

2007-12-19 23:15:42 · answer #1 · answered by AnalProgrammer 7 · 2 0

Im not that good in programming but i think you should get the ascii value for the operators and let the random function operate within those values. (not sure)

2007-12-20 07:10:55 · answer #2 · answered by gnoswodahs 2 · 0 0

fedest.com, questions and answers