posted 9 years ago
This programs adds values to a variable called money, which is initially set at 0, depending on what number is generated (prime, composite, square, or other).
I know if I have two numbers that are the same then it produces 0 all the time.
I am almost certain the multiples of 11, the composites, and the primes are always producing correct values.
For example, when I get the random numbers of 52 (composite), 73 (prime), 13 (prime), 56 (composite), 64 (square), and 23 (prime) I get a returned value of 708, but the answer is supposed to be 716.
52 + 100 + 100 +56 = 308 * 2 = 616 + 100 = 716
There must be something wrong with the loop for the squares, can anybody see anything that might not produce a correct result? Thank you!
(Moderator edit: broke up long lines.)