-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPalin.java
More file actions
39 lines (39 loc) · 747 Bytes
/
Copy pathPalin.java
File metadata and controls
39 lines (39 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.*;
public class Palin
{
int num,revnum;
Palin()
{
num=0;
revnum=0;
}
void accept()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number");
num=sc.nextInt();
}
int reverse(int y)
{
if(y==0)
return revnum;
else
revnum=revnum*10+y%10;
return reverse(y/10);
}
void check()
{
if(reverse(num)==num)
{
System.out.println("The number is Palindrome");
}
else
System.out.println("The number is not Palindrome");
}
public static void main()
{
Palin ob=new Palin();
ob.accept();
ob.check();
}
}