How to reverse a number as an integer and not as a string?

前端 未结 19 1914
名媛妹妹
名媛妹妹 2020-12-14 03:29

I came across a question \"How can one reverse a number as an integer and not as a string?\" Could anyone please help me to find out the answer? Reversal should reverse the

相关标签:
19条回答
  • 2020-12-14 04:03

    You can do something like this.

    Convert.ToInt32(new string(num.ToString().Reverse().ToArray()));
    
    0 讨论(0)
提交回复
热议问题