Answer to Question #24930 in C++ for Cwojo Cwaten

Question #24930
Write a programe in c++ to accept as input an integer and output a number when appended to the input will make the input a pallindrum.
2. Write a programme that can accept as input an integer and output the equivalence in words, Example:given an integer 1402,its output should be one thousand, four hundred and two. Thank you.
1
Expert's answer
2013-02-25T11:11:32-0500
#include <cmath>
#include <iostream>

#include <conio.h>

using namespace std;

int get_palindrome(int number)
{
int result = 0;
int digit;

while (number)
{
digit = number % 10;
result = result * 10 + digit;
number = (number - digit) / 10;
}
return result;
}

int main()
{
int number;
cout << "Enter an integer& number: ";
cin >> number;
cout << "The palindrome number is: " << get_palindrome(number) << endl;

_getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS