0
How to remove zeros at the end of an integer?
1200 op is 12 8000 op is 8 56780 op is 5678
1 Answer
+ 5
Repeatedly check the divisibility of the number by 10. If it is divisible, then divide it by 10 and store the value for the next evaluation cycle.
while ( !(number % 10) )
number /= 10;