Is there a function to determine remainders? I'm fully aware of round(), ceil(), and floor(), but is there something to determine if a division equation has a remainder?
Thanks!
-- Abe --
Detecting Remainders
Moderator: General Moderators
Until someone can let me know of any functions for remainders, I whipped this one up to share with everyone...
Hope this can help someone.
-- Abe --
Code: Select all
for ($num = 1; $num < 23; $num++){
$r = $num/10;
$q= number_format($r);
echo $q;
if (($r - $q) == 0)
print ("The number \"$num\" is divisible by 10.<br>");
else
print ("The number \"$num\" is NOT divisible by 10.<br>");
}-- Abe --
Or you can totally ignore my post and hit me upside the head for totally forgetting the precious mod entity...
Stupid me...
I should really eat my Wheaties before I code in the morning...
-- Abe --
Stupid me...
Code: Select all
for ($num = 1; $num < 23; $num++){
if (($num%10) == 0)
print ("The number \"$num\" is divisible by 10.<br>");
else
print ("The number \"$num\" is NOT divisible by 10.<br>");
}-- Abe --