Thursday, October 28, 2010

Combined events

fastgraphics : Dim a(5):Dim c(5)
Dim list(30)
font "arial",10,100
clg
For n = 1 to 4
a[n]=int(rand*8+1) : c[n]=int(rand*8+1)
next n
for draw = 1 to 600
x=int(rand*4+1): z=int(rand*4+1)
color red
rect x*20,20,15,15
color green
rect z*20+200,20,15,15
color black
For n = 1 to 4
text n*20,20,a[n]
text n*20+200,20, c[n]
next n
Print a[x] + "+" +c[z]+ "="+(a[x]+c[z])
list[a[x]+c[z]]=list[a[x]+c[z]]+1
For w = 2 to 18
text 15,14*w+10,w
rect 35,14*w+12,list[w]*2,10
next w
if draw = 3 then input "Wich sum is more frequent " , a$
refresh
pause 2/draw
clg
next draw

No comments:

Post a Comment