using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace polyn_while
{
class Program
{
static void Main(string[] args)
{
int num, rev = 0, rem,temp=0;
Console.WriteLine("enter a no");
num = Convert.ToInt32(Console.ReadLine());
temp = num;
while (num > 0)
{
rem = num % 10;
rev= rev * 10 + rem;
num = num / 10;
}
if (rev== temp)
{
Console.WriteLine("given no is polyn:{0}",rev);
}
else
{
Console.WriteLine("given no is not a polyn:{0}", rev);
}
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace polyn_while
{
class Program
{
static void Main(string[] args)
{
int num, rev = 0, rem,temp=0;
Console.WriteLine("enter a no");
num = Convert.ToInt32(Console.ReadLine());
temp = num;
while (num > 0)
{
rem = num % 10;
rev= rev * 10 + rem;
num = num / 10;
}
if (rev== temp)
{
Console.WriteLine("given no is polyn:{0}",rev);
}
else
{
Console.WriteLine("given no is not a polyn:{0}", rev);
}
Console.ReadKey();
}
}
}
No comments:
Post a Comment