Last Digit from a Integer
How i can get the last digit from a integer?
Some examples: 3451 789 20 1 (retard example, ftw) Thanks in advance. |
Re: Last Digit from a Integer
I assume it'd be something like this.
PHP Code:
|
Re: Last Digit from a Integer
Quote:
PHP Code:
EDIT: Exolent method rocks!! |
Re: Last Digit from a Integer
Quote:
26 - 10 * (26 / 10 ) non-PEMDAS: 41.6 PEMDAS: 0 |
Re: Last Digit from a Integer
You guys are either retarded or didn't think.
Code:
|
Re: Last Digit from a Integer
Quote:
Programming require math skills... Actually, programming is just math hiding behind identifiers and operators. |
Re: Last Digit from a Integer
What exactly does the modulo operator return? I'm aware that it has something to do with the remainder, but that operation makes no sense at all to me. I would've thought it'd return 0, since the remainder of 123456 / 10 is 0.
|
Re: Last Digit from a Integer
Quote:
|
Re: Last Digit from a Integer
Quote:
:evil: My bad. |
Re: Last Digit from a Integer
% work like this:
I want to do: 20 % 8; PHP Code:
Algo you can think: 20 / 8 = 2 20 % 8 = 4. 4 / 8 = 0.5 So: 8 * 2 + 4 = 20; Just a math lesson. |
| All times are GMT -4. The time now is 19:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.