Check Palindrome Number

#include <iostream>
using namespace std;
int main() {
int n;
int num;
int digit;
int rev = 0;
cin>>num;
n = num;
do {
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);
cout<<rev<< endl;
if (n == rev)
cout<<"It is a palindrome";
else
cout<<"It is not a palindrome";
return 0;
}



//Have this code and it works but want to add an if statement "You are given a positive integer from 0 to 320000, Wrong input if the input is out of the required range."

After cin >> num, write an if statement: if the num is less than 0 or num is greater than 320000, then print "wrong input" and return.

See if you can translate my sentence into code.
thank you it worked.
Topic archived. No new replies allowed.