polydrom number
//polydrom number
Console.WriteLine("Enter a number to check wheather It is polydrom or not");
int a = int.Parse(Console.ReadLine());
int j = 0;
int h = 0;
int k = 0;
for (int i = a; i != 0; i = i / 10)
{
j = 0;
j = i % 10;
if (a == i)
{
h = j * 10;
}
if (a != i)
{
k = h + j;
h = k * 10;
}
}
Console.WriteLine(k);
if (k == a)
{
Console.WriteLine("yes");
}
else
{
Console.WriteLine("no");
}
Console.ReadLine();
No comments:
Post a Comment