Skip to content

Commit

Permalink
Merge pull request #28 from yash-iiith/mybranch
Browse files Browse the repository at this point in the history
palindrome code in cpp added
  • Loading branch information
ambujraj authored Oct 1, 2018
2 parents 4c6a27d + 7010669 commit 0b85a06
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions palindrome.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
int i,n,d;
cin>>n;
int rev =0;
int num = n;
while (n>0)
{
d = n%10;
rev= rev*10 +d;
n=n/10;
}
if (num == rev)
cout << num << " is a palindrome"<< endl;
else
cout << num << " is not a palindrome" << endl;

}

0 comments on commit 0b85a06

Please sign in to comment.