#include<iostream>
using namespace std;
int main()
{
char a[100];//chuoi
cout << "enter a number with the number of digit is odd: ";
cin >> a;
int count = -1;//bien dem s o ky tu
for (int i = 0; i < strlen(a); i++)
{
count++;
}
//cout << count;
int k;
k = (count - 2) / 2;
int m = 0,couting=0;
while (m != (k+1))
{
if (a[m] == a[count - m])
couting++;//bien dem
m++;
}
if (couting == (k+1))
cout << a << " is Reversible number." << endl;//so nghich dao
else
cout << a << " is not Reversible number." << endl;
system("pause");
return 0;
}
mình có suy nghĩ ra cách làm tìm n có phải số thuận nghịch không vd 33533 là số thuận nghịch. không biết có cách nào hay và tối ưu hơn không?