using System;
namespace Console_ReverseNo
{
class ReverseNo
{
public void dispRev()
{
Console.WriteLine("Enter a Number");
int numb = int.Parse(Console.ReadLine());
int reverse = 0;
while (numb > 0)
{
int rem = numb % 10;
reverse = (reverse * 10) + rem;
numb = numb / 10;
}
Console.WriteLine("Reverse number={0}", reverse);
}
static void Main(string[] args)
{
ReverseNo rn = new ReverseNo();
rn.dispRev();
Console.ReadKey();
}
}
}
No comments:
Post a Comment