Skip to content

Commit

Permalink
Merge pull request #94 from kajurampatell/patch-3
Browse files Browse the repository at this point in the history
check whether number is palindrome or not
  • Loading branch information
avastino7 authored Nov 1, 2022
2 parents 43fc520 + 77b8bd8 commit f381c3b
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 f381c3b

Please sign in to comment.