kazooie21
November 21st, 1999, 09:29 PM
I need a For Next loop that will calculate and display the square of the even numbers from 2 to 12.
kazooie21
kazooie21
|
Click to See Complete Forum and Search --> : Please help! Need For Next loop for square! kazooie21 November 21st, 1999, 09:29 PM I need a For Next loop that will calculate and display the square of the even numbers from 2 to 12. kazooie21 Lothar Haensler November 22nd, 1999, 02:12 AM Dim i as Integer for i = 2 to 12 If i Mod 2 = 0 then Debug.print i & " " & Sqr(i) End If next i BrewGuru99 November 22nd, 1999, 07:24 PM Since Mod is a relatively slow process I would use the step option instead of mod'ing each iteration. Dim i as Integer for i = 2 to 12 step 2 Debug.print i & " " & Sqr(i) next i Brewguru99 Lothar Haensler November 23rd, 1999, 01:32 AM although I doubt that speed is a major concern in this case :-) , I think you solution is more elegant. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |