I need help writing a program that displays all the palindrome numbers between 1 and a user inputted number, n. The entire code is below, it's for an assignment. The program works but I have no idea how to display all the palindrome numbers between 1 and n.
do
{
int n, t1 = 0, t2 = 1, nextTerm = 0;
cout << "\nEnter an integer ";
cin >> n;
if (n>0 && n<160)
{
cout <<" "<<endl;
cout << "First "<<n<<" terms of Fibonacci series are:- \n";
while(num != 0)
{
digit = num % 10;
sum += digit * digit * digit;
num /= 10;
}
if(sum == n)
{
cout <<" \n\n"<< n << " is an Armstrong number.\n";
}
else
{
cout <<" \n\n"<< n << " is NOT an Armstrong number.\n";
}
long long int a,factorial=1;
for (a=1;a<=n;a++)
{
factorial = factorial * a;
}
cout <<"\nFactorial of "<<n<<" is: "<<factorial<<endl;
int reversenumber=0, counter, b=n;
while ( b!=0)
{
counter = b%10;
reversenumber = (reversenumber *10) + counter;
b /=10;
}
cout <<"\nReverse of "<<n<<" is: "<<reversenumber<<endl;
int n1,dig1,rev=0;
n1=n;
do{dig1=n%10;
rev=(rev*10)+dig1;
n=n/10;} while (n!=0);
if (n1==rev)
cout<<n1<<" is a palindrome";
else
cout<<n1<<" is not a palindrome";