C#.Net Program 5 :Get a Number and Display the Number with its Reverse

 C#.Net Program 5 :Get a Number and Display the Number with its Reverse


flip kart app Code Explanation:

C#.net Code:

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

namespace CSharpExamples
{
    //C#.Net program 5: 
    class ReverseOfTheNumber
    {
        static void Main(string[] args)
        {
            int number, reverseOfNumber = 0;
            Console.WriteLine("Please a Number : ");
            number = int.Parse(Console.ReadLine());
            while (number != 0)
            {
                reverseOfNumber = reverseOfNumber * 10;
                reverseOfNumber = reverseOfNumber + number % 10;
                number = number / 10;
            }
            Console.WriteLine("Reverse of Entered Number is : " + reverseOfNumber);
            Console.ReadLine();

        }
    }
}



If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar