Skip to content
Open
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
37 changes: 37 additions & 0 deletions Palindrome.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
SUBMITTED BY: Deadeye001
THIS CODE CHECKS IF AN ENTERED NUMBER IS PALINDROME NUMBER OR NOT
DATE:17/10/2021
*/

#include <bits/stdc++.h>
using namespace std;

int checkpal(int n)
{
//function to check if no. is palindrome or not
int a=n;
int sum=0;
while(a!=0)
{
int d=a%10;
sum=(sum*10)+d;
a=a/10;
}
if(sum==n)
return 1;
else
return 0;
}

int main()
{
//driver function
int n;
cin>>n;
if(checkpal(n))
cout<<n<<" is a Palindrome number";
else
cout<<n<<" is NOT a Palindrome number";
return 0;
}