Skip to content

Commit c373383

Browse files
committed
added palindrome checker program
1 parent c2e01ee commit c373383

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

palindrome-checker.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.Scanner;
2+
class PalindromeExample
3+
{
4+
public static void main(String args[])
5+
{
6+
int r,sum=0,temp;
7+
int n;
8+
9+
Scanner sc = new Scanner(System.in);
10+
System.out.println("Enter the number:");
11+
n = sc.nextInt();
12+
temp=n;
13+
while(n>0)
14+
{
15+
r=n%10;
16+
sum=(sum*10)+r;
17+
n=n/10;
18+
}
19+
if(temp==sum)
20+
System.out.println("palindrome number ");
21+
else
22+
System.out.println("not palindrome");
23+
}
24+
}

0 commit comments

Comments
 (0)