How to inverse any number in C#

using System;
namespace ConsoleApplication2
{
    class reverse
    {
        static void Main(string[] args)
        {
            int a,b,reverse=0;
            Console.WriteLine("enter the number you want too reverse ");
            a = Int32.Parse(Console.ReadLine());
            while (a != 0)
            {

                b = a % 10;
                reverse = reverse * 10 + b;
                a /= 10;
              }

            Console.WriteLine("your reversed number is ="+ reverse );
            Console.ReadLine();
        } 
}
       }







No comments:

Post a Comment