Friday, November 2, 2012

palindrome no in c# with out using Length function


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

namespace string_coniration
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = "*";
            string c, b,d=string.Empty,k;
            int i,t;
           
            Console.WriteLine("enter your name");
            c = Console.ReadLine();
            b = c + a;
            for (i = 0; b[i] != '*'; i++)
            {
            }

            t = i;
            Console.WriteLine("the lenth is\t" + i);
            Console.WriteLine("");

 for (i = t-1; i >= 0; i--)
            {
                d = d + b[i];

            }
            Console.WriteLine("" + d);
            k = d + a;
            if (k == b)
            {
                Console.WriteLine("it is a pladrom");
            }
            else
            {
                Console.WriteLine("it is not pladrom");
            }
        }
        }
   
}

No comments:

Post a Comment