31 lines
727 B
C#
31 lines
727 B
C#
|
/*
|
||
|
* C# Program to Get a Number and Display the Number with its Reverse
|
||
|
*/
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace Program
|
||
|
{
|
||
|
class Program
|
||
|
{
|
||
|
static void Main(string[] args)
|
||
|
{
|
||
|
int num, reverse = 0;
|
||
|
Console.WriteLine("Enter a Number : ");
|
||
|
num = int.Parse(Console.ReadLine());
|
||
|
while (num != 0)
|
||
|
{
|
||
|
reverse = reverse * 10;
|
||
|
reverse = reverse + num % 10;
|
||
|
num = num / 10;
|
||
|
}
|
||
|
Console.WriteLine("Reverse of Entered Number is : "+reverse);
|
||
|
Console.ReadLine();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Enter a Number : 123
|
||
|
Reverse of Entered Number : 321
|