J Jimpin23 New Member May 30, 2020 #1 For Loop statement that loops the numbers from 1-100 and determines all numbers Divisible by 3. Is my code correct? Sub bt1_Click Dim Num,Res As Int Num = 0 Res = 0 For Loop Res Res = Num % 3 Num = Num + 1 Loop Bt1.Text = “Done” End Sub Just beginner hehe
For Loop statement that loops the numbers from 1-100 and determines all numbers Divisible by 3. Is my code correct? Sub bt1_Click Dim Num,Res As Int Num = 0 Res = 0 For Loop Res Res = Num % 3 Num = Num + 1 Loop Bt1.Text = “Done” End Sub Just beginner hehe
M Mahares Expert Licensed User Longtime User May 30, 2020 #2 Jimpin23 said: 1-100 and determines all numbers Divisible by 3 Click to expand... Here is what your code should be: Code: Copy For i=1 To 100 If i Mod 3 =0 Then Log(i) 'show only numbers divisible by 3 End If Next You need to use code tags when you post code to make it wasy to read. Upvote 0
Jimpin23 said: 1-100 and determines all numbers Divisible by 3 Click to expand... Here is what your code should be: Code: Copy For i=1 To 100 If i Mod 3 =0 Then Log(i) 'show only numbers divisible by 3 End If Next You need to use code tags when you post code to make it wasy to read.
J Jimpin23 New Member May 30, 2020 #3 Mahares said: Here is what your code should be: Code: Copy For i=1 To 100 If i Mod 3 =0 Then Log(i) 'show only numbers divisible by 3 End If Next You need to use code tags when you post code to make it wasy to read. Click to expand... Next time sir. Sorry . thanks btw Upvote 0
Mahares said: Here is what your code should be: Code: Copy For i=1 To 100 If i Mod 3 =0 Then Log(i) 'show only numbers divisible by 3 End If Next You need to use code tags when you post code to make it wasy to read. Click to expand... Next time sir. Sorry . thanks btw
M Mahares Expert Licensed User Longtime User May 30, 2020 #4 Jimpin23 said: Next time sir. Sorry . thanks btw Click to expand... No big deal. I just thought I mention the code tags to you now before you hear it from Erel, but it is understandable in your case as you just started with the forum. Upvote 0
Jimpin23 said: Next time sir. Sorry . thanks btw Click to expand... No big deal. I just thought I mention the code tags to you now before you hear it from Erel, but it is understandable in your case as you just started with the forum.
A Alex_197 Well-Known Member Licensed User Longtime User May 31, 2020 #5 Why don't save "time and money" by using Code: Copy For i=0 To 100 Step 3 Log(i) Next In this code you don't have to waste your time on useless iterations. So you will get 0 3 6 and so on Upvote 0
Why don't save "time and money" by using Code: Copy For i=0 To 100 Step 3 Log(i) Next In this code you don't have to waste your time on useless iterations. So you will get 0 3 6 and so on