Return last 5 digits of a number

前端 未结 3 559
栀梦
栀梦 2021-02-14 05:17

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

Example input:

123456789

Would return: 56789

3条回答
  •  名媛妹妹
    2021-02-14 05:39

    I suggest using the modulus if working with integerss:

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

    Something like that

提交回复
热议问题