latest Post

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();
}
}
}
Here is the output of the C# Program:
Enter a Number : 123
Reverse of Entered Number : 321

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment