- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA96.java
More file actions
Latest commit
52 lines (46 loc) · 829 Bytes
/
Copy pathA96.java
File metadata and controls
52 lines (46 loc) · 829 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
40
41
42
43
44
45
46
47
48
49
50
51
52
importjava.util.Scanner;
classA96
{
publicstaticvoidmain(String[] args)
{
inta[] = {2,3,7,8,10,9};
intb[] = newint[a.length];
intcount = 0;
System.out.println("------ REVERSE OF ARRAY and Check it is PALINDROME or not ------"+a.length);
intj = a.length-1;
for (inti=0;i<a.length ;i++ )
{
if (i<=j)
{
inttemp =a[i];
a[i] = a[j];
a[j] = temp;
if (a[i]==a[j])
{
b[i]=a[i];
b[j]=a[i];
}
j--;
}
}
for (intk=0;k<a.length ;k++ )
{
System.out.print(a[k] + " ");
}
for (intl=0;l<a.length ;l++ )
{
if (a[l]==b[l])
{
count++;
}
}
if(count==a.length)
{
System.out.println("IT is Palindrome");
}
else
{
System.out.println("IT is NOT Palindrome");
}
}
}