Visual Basic
John Thorpe and students
Dim number_bottles As Integer
For number_bottles = 10 To 1 Step -1
If number_bottles = 1 Then
txtPrynt.Text = txtPrynt.Text + vbCrLf + Str(number_bottles) + " "
+ "green bottle sitting on the wall!"
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottle sitting on the wall!"
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "and if one green bottle should accidentally fall"
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be no green bottles sitting on the wall!"
Else
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottles sitting on the wall!"
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + Str(number_bottles)
+ " " + "green bottles sitting on the wall!"
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "and if one green bottle should accidentally fall"
End If
If number_bottles = 2 Then
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be " + Str(number_bottles - 1) + " green bottle sitting on the wall!"
Else
If number_bottles <> 1 Then
txtPrynt.Text = txtPrynt.Text + vbCrLf + " " + "there will be " + Str(number_bottles - 1) + " green bottles sitting on the wall!"
End If
End If
Next number_bottles
Comments (0)
You don't have permission to comment on this page.