TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Find Given Number Is Palindrome Or Not And Display Reverse A Number In C#
Vijayaragavan S
Aug 24
2016
Code
705
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
class
Program {
static
void
Main() {
//Variable Declaration
int
no, tmp;
int
digit;
int
reverse = 0;
//Read
Console.WriteLine(
"Enter the number"
);
no = Convert.ToInt16(Console.ReadLine());
tmp = no;
//Reverse
while
(no != 0) {
digit = no % 10;
reverse = reverse * 10 + digit;
no = no /= 10;
}
Console.WriteLine(
"The reverse of the given number is: "
+ reverse);
//Polindrome
if
(tmp == reverse) {
Console.WriteLine(
"The number is a palindrome!"
);
Console.ReadKey();
}
else
{
Console.WriteLine(
"The given number is not a palindrome"
);
Console.ReadKey();
}
}
}
Find Given Number Is Palindrome
C#