Take input number from the user and print its reverse.
从用户处获取输入号码并打印其反面。
Example:
例:
Input:
12345
Output:
54321
Here, we are implementing program to reversing a given number using 2 different ways.
在这里,我们正在实施程序,以使用2种不同的方式来反转给定的数字 。
1) Famous approach for reversing the number: Take input from the user and typecast into an integer, then iterate in the loop till num is not become zero, inside the loop:
1) 逆转数字的著名方法 :从用户输入并将其类型转换为整数,然后在循环中循环直到num在循环内不为零:
Find out the remainder.
找出其余的。
Using this: rev_num = rev_num * 10 + remainder.
使用这个:rev_num = rev_num * 10 +余数。
Update that number by diving by 10.</