Brain Academy?

BlitzMax Forums/BlitzMax Programming/Brain Academy?

this code sets the first three nubers = the answer:
Strict
SeedRnd MilliSecs()
Local total = 9+Rand(10)
Local i% 
Local n[5]
Local sum = 0
For i = 0 To 2 
	Repeat 
		n[i] = Rand(total/2)
	Until n[i] > 0
	If (sum + n[i]) > total Or (i = 2 And (n[i]+sum) < total)
		n[i] = total - sum
	EndIf
	sum = sum+n[i]
Next
n[3] = Rand(9)
n[4] = Rand(9)
i = Rand(4)
Print total
n.sort()
For i = 0 To 4
	Print i+" "+n[i] 
Next

the first three numbers are the answer. the last two numbers are just random numbers generated. it is all just a matter of what order you display them.
note that even the last two numbers can generate a valid answer but all you need to do is add the numbers left compare them to the answer and you have your valid comparison. you will have at least one valid set of numbers