TheAlgorithms-C-Plus-Plus/others/palindrome_of_number.cpp
2020-05-26 09:40:57 -04:00

22 lines
352 B
C++

#include <algorithm>
#include <cstring>
#include <iostream>
int main() {
int num;
std::cout << "Enter number = ";
std::cin >> num;
std::string s1 = std::to_string(num);
std::string s2 = s1;
reverse(s1.begin(), s1.end());
if (s1 == s2)
std::cout << "true";
else
std::cout << "false";
return 0;
}