Monday, 30 December 2013

Pallindrom Number using Console Application in C#

Ans:-

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

namespace Logicals
{
    class Pallindromnumber
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Number nOly..");
            int num = int.Parse(Console.ReadLine());
            int reminder, pallindrom = 0;
            int store = num;
            while (num > 0)
            {
                reminder = num % 10;
                pallindrom = pallindrom * 10 + reminder;
                num = num / 10;

               
            }
            if (pallindrom == store)
            {
                Console.WriteLine("It's a Pallindrom No..");
            }
            else
            {
                Console.WriteLine("It's Not a Pallindrom No..");
            }

            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment