I want the output to have the numbers on the first set to go from 0-20 and the second set to 0-100 but not 0,1,2,3,4,5 but 0,5,10 basically skipping each 5. Here's a screenshot of my code and output.
Code:
Output:
CodePudding user response:
A couple options for you...
Option 1:
For a As Integer = 0 To 20
Dim b As Integer = a * 5
Console.WriteLine("index number:({0}) = {1}", a, b)
Next
Option 2:
Dim b As Integer = 0
For a As Integer = 0 To 20
Console.WriteLine("index number:({0}) = {1}", a, b)
b = b 5
Next
Option 3:
Dim a As Integer = 0
Dim b As Integer = 0
While a <= 20
Console.WriteLine("index number:({0}) = {1}", a, b)
a = a 1
b = b 5
End While
In C#, you could do:
for(int a=0,b=0; a<=20; a ,b =5) {
Console.WriteLine("index number:({0}) = {1}", a, b);
}