Skip to content

Commit

Permalink
updated with changes
Browse files Browse the repository at this point in the history
  • Loading branch information
raksha009 committed Mar 21, 2020
1 parent c0d6bb8 commit a90f948
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Palindrome/palindrome_no.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class palindrome_no {
public static int reverse(int number) {
int reverseno = 0 ;

while (number >0) {
reverseno = (int) (reverseno*Math.pow(10, 1) + number%Math.pow(10, 1));
number = (int) (number/Math.pow(10, 1));
while (number > 0) {
reverseno = (int) (reverseno * Math.pow(10, 1) + number % Math.pow(10, 1));
number = (int) (number / Math.pow(10, 1));
}
return reverseno;
}
Expand All @@ -33,12 +33,15 @@ public static void main(String[] args) {

/*
Test cases
INPUT
Hey, Enter any number
1223
OUTPUT
Number is not a PALINDROME
INPUT
Hey, Enter any number
1223221
OUTPUT
Number is a PALINDROME
*/

0 comments on commit a90f948

Please sign in to comment.