lundi 26 janvier 2015

If Statement and For-loops - How to take only every 5th number?

What I'm trying to do is loop through the numbers 0 to 100 and check which ones are divisible by 5 and have that print to console, this is what I've done so far:



Module Module1

Sub Main()

For i = 0 To 100
If i / 5 = Then
Console.WriteLine(i)
End If

Next

Console.ReadLine()


End Sub

End Module


I'm wondering if I'm able to have an If statement check with a range of numbers for example like this:



If i / 5 = 0 to 19 Then


Is that possible?


Thank you in advance!


Aucun commentaire:

Enregistrer un commentaire