From 59be834836c839db7fba0ab852193252e6fa3eeb Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Tue, 26 May 2020 09:26:40 -0400 Subject: [PATCH] fixed lint (cherry picked from commit fb3a8091f9492ccac9b66572612e39e394eed4ad) --- others/palindrome_of_number.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/others/palindrome_of_number.cpp b/others/palindrome_of_number.cpp index 647803997..dda872882 100644 --- a/others/palindrome_of_number.cpp +++ b/others/palindrome_of_number.cpp @@ -1,23 +1,20 @@ -#include #include +#include -using namespace std; +int main() { + int num; + std::cout << "Enter number = "; + std::cin >> num; -int main() -{ - int num; - cout << "Enter number = "; - cin >> num; + std::string s1 = std::to_string(num); + std::string s2 = s1; - string s1 = to_string(num); - string s2 = s1; + reverse(s1.begin(), s1.end()); - reverse(s1.begin(), s1.end()); + if (s1 == s2) + std::cout << "true"; + else + std::cout << "false"; - if (s1 == s2) - cout << "true"; - else - cout << "false"; - - return 0; + return 0; }