Hi guys,
I am a beginner in VB, I have one exercise to solve:
Rewrite the following program segment by using For Next statement instead of the Do Loop
statement, and by using Select Case statement instead of the nested If, ElseIf statements. Do not
change the names or the values of the variables.
Dim count, j, k As Integer
count = 10
Do While count <= 100
If j = 15 Then
k = j + k
ElseIf j > 15 Then
k = Int(j / 5)
ElseIf j < 15 And j >= 7 Then
k = j Mod count
Else : k = 0
End If
count += 10
Loop
I did this and it doesn't work, can you help me?
For count = 1 To 100
Select Case j
Case 15
k = j + k
Case Is > 15
k = Int(j / 5)
Case Is < 15 and Case is >= 7
Case Else k = 0
End Select
count += 0
Next
I am a beginner in VB, I have one exercise to solve:
Rewrite the following program segment by using For Next statement instead of the Do Loop
statement, and by using Select Case statement instead of the nested If, ElseIf statements. Do not
change the names or the values of the variables.
Dim count, j, k As Integer
count = 10
Do While count <= 100
If j = 15 Then
k = j + k
ElseIf j > 15 Then
k = Int(j / 5)
ElseIf j < 15 And j >= 7 Then
k = j Mod count
Else : k = 0
End If
count += 10
Loop
I did this and it doesn't work, can you help me?
For count = 1 To 100
Select Case j
Case 15
k = j + k
Case Is > 15
k = Int(j / 5)
Case Is < 15 and Case is >= 7
Case Else k = 0
End Select
count += 0
Next