Hello I am new to this forum, I have tried to search did not find the answer to my question. I would like to create a "For loop" that summarizes the numbers entered by the user and displays the result. I have come this far:
Public Sub Readinput()
Dim NumOfInt As Integer
Dim i As Integer = 0
Dim numbers As Integer
Dim result As Integer
Console.Write("How many numbers do you want to add? ")
NumOfInt = CInt(Console.ReadLine)
For i = 1 To NumOfInt Step 1
Console.Write("Enter your number: ")
numbers = CInt(Console.ReadLine)
Next
Console.WriteLine(result)
End Sub
End Class
I guess this´s a easy question for most of you but I´m grateful for your help
Best regards
Johan
Public Sub Readinput()
Dim NumOfInt As Integer
Dim i As Integer = 0
Dim numbers As Integer
Dim result As Integer
Console.Write("How many numbers do you want to add? ")
NumOfInt = CInt(Console.ReadLine)
For i = 1 To NumOfInt Step 1
Console.Write("Enter your number: ")
numbers = CInt(Console.ReadLine)
Next
Console.WriteLine(result)
End Sub
End Class
I guess this´s a easy question for most of you but I´m grateful for your help
Best regards
Johan