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
Is java easier than c++?
Define macro.
Is c++ harder than java?
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
What are the benefits of operator overloading?
what are Operators and explain with an example?
What is static in c++?
Is c++ map a hash table?
Explain the difference between overloading and overriding?
What is the difference between a template and a macro?
Differentiate between a constructor and a destructor in c++.
what are function pointers?
Write a function that swaps the values of two integers, using int* as the argument type?
How are Structure passing and returning implemented by the compiler?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)