
May 21st, 2003, 01:03 PM
|
 |
not a fan of fascism (n00b)
|
|
Join Date: Feb 2003
Location: ct
|
|
|
basically you are just checking to see if any of the numbers smaller than or equal to the square root of your target number can be divided into your number without a remainder. The % (mod) operator returns the remainder of the division operation. So, in this exampe if our target # was 25, we would run the loop for (i = 2 -> i = 5) each iteration of the loop, we divide our target # 25 by the current value of i and check to see if there is a remainder. you can see that wen i gets to 5, the if condition will evaluate to true, since 5 % 5 == 0.
|