66 976
Assignments Done
99,2%
Successfully Done
In November 2018

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.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions