Reverse of a number with leading zeroes

后端 未结 10 1544
庸人自扰
庸人自扰 2021-01-14 05:17

How do we reverse a number with leading zeroes in number ? For ex: If input is 004, output should be 400.

I wrote below program but it works only when n

10条回答
  •  时光说笑
    2021-01-14 06:09

    Leading zeroes are not represented by binary numbers (int, double, etc.) So you'll probably have to use std::string. Read the input into the string, then call std::reverse() passing the string as input.

提交回复
热议问题