reverse the position of integer digits?

后端 未结 13 2530
予麋鹿
予麋鹿 2021-02-09 15:00

i have to reverse the position of integer like this

input = 12345

output = 54321

i made this but it gives wrong output e.g 5432

#include         


        
13条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-09 15:26

    Well, remember that integer division always rounds down (or is it toward zero?) in C. So what would num / i be if num < 10 and i = 10?

提交回复
热议问题