Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Adding code for Palindrome_Number. #487

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"iostream": "cpp"
}
}
36 changes: 36 additions & 0 deletions Programming/C++/Palindrome_Number/Palindromenumber.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>

using namespace std;

int main()
{

int x, rev = 0, rem, ori;
cout<<"Enter an integer: ";
cin>>x;

ori=x;
while (x != 0)
{
rem = x % 10;
rev = rev * 10 + rem;
x /= 10;
}

if (ori>0)
{

if(ori==rev)
cout<<"True";
else
cout<<"False";
}
else
{
cout<<"False";

}
return 0;


}