Return last 5 digits of a number

前端 未结 3 769
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 05:31

How do you only display the last 5 digits of a number?

Example input:

123456789

Would return: 56789

3条回答
  •  长发绾君心
    2021-02-14 05:47

    I suggest using the modulus if working with integerss:

    int someNumber = 123456789;
    int lastFive = someNumber % 100000;
    

    Something like that

提交回复
热议问题