3.    Study the following code. what messages will be displayed in the message box?
 Dim intCounter As Integer
 Dim dblSum As Double, dblNumber As Double
 dblSum = 0
 intCounter = 1
 Do While intCounter < 6
 dblSum = dblSum + Convert.ToDouble(intCounter)
 If intCounter Mod 3 = 0 Then
 dblNumber = 5.0
 End If
 dblSum = dblSum + dblNumber
 intCounter = intCounter + 2
 Loop
 MessageBox.Show("The Sum is: " & dblSum.ToString(),"IS122")
4.    Rewrite the following section of code using a For Next loop instead of a Do While loop.
 Dim intSum As Integer
 int intCount As Integer
 intCount = -5
 Do While intCount <= 15 Â
 intSum = intSum + intCountÂ
 intCount = intCount + 1
 Loop
Question 3:
Answer:
The messages will be displayed in the message box:
The Sum is: 19
Question 4:
Answer:
 Dim intSum As Integer
 Dim intCount As Integer
 For intCount = -5 To 15
   intSum = intSum + intCount
 Next
Comments
Leave a comment