Find the reverse of a number (ex : 2500 reverse 0025) without the help of string or character

前端 未结 4 811
一整个雨季
一整个雨季 2020-12-20 07:42

Is there any technique for finding the reverse when there are zeros at the end.

While following the algorithm of %10 technique the result is 52. And the 0\'s are mis

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-20 08:30

    You cannot represent an integer with leading zeros as a single integer variable, that information is simply not part of the way bits are allocated in an integer. You must use something larger, i.e. a string or an array of individual (small integer) digits.

提交回复
热议问题