76 836
Assignments Done
Successfully Done
In June 2019

Answer to Question #17813 in C++ for Asma

Question #17813
1- Write a program that prompts the user to input a positive integer and then saves the number with the digits reversed into anther integer variable called Rev.
2- A number is known as palindrome number if the reverse of the digits is equal to the number itself.
Enter the Number
The Reversed is: 12621
The number: 12621 is Palindrome
Expert's answer
#include <iostream>
#include <string>
using namespace std;
int main(){
cout<<"Enter number\n";
string a, Rev;
Rev = a;
cout<<"The reversed is: "<< Rev<<endl;
bool ok = true;
for (int i = 0 ; i < Rev.size() / 2 ; i++){
& if (Rev[i] != Rev[Rev.size()-1-i]){
& cout<<"The number "<<a<< " isn't Palindrome\n";
& ok = !ok;
& break;
& }
if (ok) cout<<"The number "<<a<< " is Palindrome\n";

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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions