From fe877cfa941402345903b47da48ee5393ba06a39 Mon Sep 17 00:00:00 2001 From: Swanand Joshi Date: Tue, 16 Dec 2025 22:51:52 +0530 Subject: [PATCH] Solution for ISSUE 3046 --- main.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000000..ef97a23188 --- /dev/null +++ b/main.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +bool isPalindrome(int num) { + if(num<0) { + return false; + } + int temp=num, rev=0; + while(temp!=0) { + rev=rev*10 + temp%10; + temp=temp/10; + } + if(rev==num) { + return true; + } + return false; +} + +int main() { + int num; + cout << "Enter an integer : " << endl; + cin >> num; + + cout << isPalindrome(num); + return 0; +} \ No newline at end of file