class Program { static void Main() { Console.WriteLine("Enter a Number: "); int num = Convert.ToInt32(Console.ReadLine()); int reversed = 0; while (num > 0) { int digit = num % 10; reversed = reversed * 10 + digit; num /= 10; } Console.WriteLine("Reversed Num: " + reversed); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter