+ 3

What is the output of this code? And explain also

n = 123 result = 0 while (n>0): remainder = int(n % 10) result = result * 10 + remainder n = int(n / 10) print(result)

28th Feb 2019, 9:42 AM
Vaagish Hambiria
Vaagish Hambiria - avatar
3 Answers
+ 2
Thats the code to reverse the number. Output is 321
28th Feb 2019, 9:52 AM
Sarthak Pokhrel
Sarthak Pokhrel - avatar
0
321
1st Mar 2019, 5:09 PM
shubhangi mishra
shubhangi mishra - avatar