Sunday, 25 March 2018

Program to find reverse of the number


//Program to find reverse of the number
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cs6
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, r = 0;
            Console.WriteLine("Enter any integer value");
            n = int.Parse(Console.ReadLine());
            while (n != 0)
            {
                r = r * 10;
                r = r + n % 10;
                n = n / 10;
            }
            Console.WriteLine("Reverse of the entered number="+r);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.