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;
Comments
Leave a comment