Skip to content

Commit

Permalink
check whether number is palindrome or not
Browse files Browse the repository at this point in the history
  • Loading branch information
kajurampatell authored Oct 31, 2022
1 parent 01965cb commit 77b8bd8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions isPalindrome.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Solution {
public boolean isPalindrome(int x) {

int r =0;
int z =x;
if(x>=0){
while(x!=0){

int remi = x%10;
x=x/10;
r=r*10 + remi;
}

if (r==z){
return true;
}
else return false;
}
else
return false;

}
}

0 comments on commit 77b8bd8

Please sign in to comment.