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;

}

#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;

}

## Comments

## Leave a comment