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
What are the four main data types?
How to declaring variables in c++?
Is c++ a low level language?
What is a down cast?
How much do coding jobs pay?
What is the use of ::(scope resolution operator)?
Why are pointers used?
When are exception objects created?
Explain function overloading
What is the use of class in c++?
What do nonglobal variables default to a) auto b) register c) static
How does work in c++?
What is the oldest programming language?
What do you mean by overhead in c++?
Is linux written in c or c++?