#### Archived

This topic is now archived and is closed to further replies.

# is X divisible by 10?

This topic is 5951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, how do I check to see if X is divisible by 10? I assume I need the % operation, however I''m not too good with it. Thanks Scott Email Website
"If you try and don''t succeed, destroy all evidence that you tried."

##### Share on other sites
If X in an integer:
  if(X%10 == 0) X_Is_Divisible_by_10;

[Resist Windows XP''s Invasive Production Activation Technology!]

##### Share on other sites
quote:
Original post by wojtos
Hi, how do I check to see if X is divisible by 10? I assume I need the % operation, however I''m not too good with it.

The modulus (%) operator returns the remainder. Ex. a % b returns the remainder of a/b. If the remainder is zero (a % b == 0) then then a is divisible by b.

##### Share on other sites
groovy, thanks for the help/explanations.

Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

##### Share on other sites
One thing that might be totally obvious (to me anyway) is that 4%5 would be 4... just something to remember