We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Sunday, February 22, 2015

Write a program to reverse number using C#

Write a program to reverse number using C#

using System;

namespace Learn
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter a Number");
            int numb = int.Parse(Console.ReadLine());
            int reverse = 0;
            while (numb > 0)
            {
                int rem = numb % 10;
                reverse = (reverse * 10) + rem;
                numb = numb / 10;
              
            }
            Console.WriteLine("Reverse number={0}", reverse);
            Console.ReadLine();
        }
    }
}

No comments: