using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace polyn
{
class Program
{
static void Main(string[] args)
{
string s,revs="";
Console.WriteLine("enter string");
s = Console.ReadLine();
for (int i = s.Length-1 ; i>= 0; i--)
{
revs += s[i].ToString();
}
if (revs == s)
{
Console.WriteLine("given string is polyndrum \ngiven string is {0}\nrevs string is {1}", s, revs);
}
else
{
Console.WriteLine("given string is not polyndrum \ngiven string is {0}\nrevs string is {1}", s, revs);
}
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace polyn
{
class Program
{
static void Main(string[] args)
{
string s,revs="";
Console.WriteLine("enter string");
s = Console.ReadLine();
for (int i = s.Length-1 ; i>= 0; i--)
{
revs += s[i].ToString();
}
if (revs == s)
{
Console.WriteLine("given string is polyndrum \ngiven string is {0}\nrevs string is {1}", s, revs);
}
else
{
Console.WriteLine("given string is not polyndrum \ngiven string is {0}\nrevs string is {1}", s, revs);
}
Console.ReadKey();
}
}
}
No comments:
Post a Comment