easiest way to truncate a number

I'm writing a PBasic program that compares to sensor readings, ( ultrasonic). I'd like to truncate the first number so that the when I compare the 2 sensors, there not so sensitive. Does this make sense? If the results of one is 1234 and the other is 1239, I'd like to change them both to 1230. Thanks for any help.

Comments

  • Off the top of my head, divide by 10, then multiply by ten.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • What Hal said. If you would prefer rounding to truncation, add 5 before you divide.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
Sign In or Register to comment.