0% found this document useful (0 votes)
28 views

Ax B C

Uploaded by

lela
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Ax B C

Uploaded by

lela
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sub RandomQuestion()

Dim a As Integer
Dim b As Integer
Dim i As Integer
Dim j As Integer
Dim t As String
i = 1
For j = 1 To Int(10 * Rnd)
i = -1 * i
Next j
a = i * Int(10 * Rnd)
If a = 0 Then a = 2
i = 1
For j = 1 To Int(10 * Rnd)
i = -1 * i
Next j
b = i * Int(10 * Rnd)
i = 1
For j = 1 To Int(10 * Rnd)
i = -1 * i
Next j
x = i * Int(10 * Rnd)
c = a * x + b
If (a = -1) Then
t = "-"
Else
If a = 1 Then
t = ""
Else
t = Str$(a)
End If
End If
t = t & "x"
If b = 0 Then
t = t & "=" & Str$(c)
Else
If b > 0 Then
t = t & "+" & Str(Abs(b)) & "=" & Str$(c)
Else
t = t & "-" & Str(Abs(b)) & "=" & Str$(c)
End If
End If
answer = InputBox(t & " x=")
If answer = x Then
RightAnswer
Else
WrongAnswer
End If
End Sub

You might also like