A
A
Amalat2021-03-11 10:40:59
Visual Basic
Amalat, 2021-03-11 10:40:59

How to convert a construct to a While loop?

Can the following construct be converted from a For Loop to a While Loop?

Public Sub example1()
Dim N As Integer
Dim i As Integer
Dim Sum As Long
N = InputBox("Введите целое число")
Sum = 0
For i = 2 To N Step 2
 Sum = Sum + i
Next i
MsgBox "Сумма= " + Str(Sum)
End Sub

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question