Program for Reverse number without in-build function in asp.net c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

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

       


Program for Reverse number without in-build function in asp.net c# Program for Reverse number without in-build function in asp.net c# Reviewed by NEERAJ SRIVASTAVA on 10:26:00 AM Rating: 5

No comments:

Powered by Blogger.