write program for palindrome
Answer Posted / prashant gupta
//Using C# Language
using System;
class Palindrome
{
public void CalculatePalindrome()
{
//int number;
Console.Write("Enter the no to check its
Palindromic property : ");
int number = int.Parse(Console.ReadLine());
int temp = number;
int sum = 0;
while (number > 0)
{
Int32 remainder = number % 10;
number = number / 10;
sum = sum * 10 + remainder;
}
if (sum == temp)
{
Console.WriteLine("The no {0} is
palindrome.", sum);
}
else
{
Console.WriteLine("The no {0} is not a
palindrom no.", sum);
}
}
public static void Main()
{
Palindrome _palindrome = new Palindrome();
_palindrome.CalculatePalindrome();
}
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why should you learn c++?
How does list r; differs from list r();?
the first character in the variable name must be an a) special symbol b) number c) alphabet
What do you mean by vtable and vptr in c++?
Do you know the use of vtable?
Are strings mutable in c++?
What is const pointer and const reference?
why is c++ called oops? Explain
Explain the uses oof nested class?
Is c++ free?
What is the difference between global variables and static varables?
What is the main function c++?
What is auto used for in c++?
What is an object in c++?
What are the benefits of operator overloading?