-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathprogram.java
More file actions
26 lines (26 loc) · 463 Bytes
/
program.java
File metadata and controls
26 lines (26 loc) · 463 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
import java.io.*;
import java.util.*;
class prg{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s=sc.next();
int start=0;
int end=s.length()-1;
int flag=0;
while(start<end)
{
if(s.charAt(start)!=s.charAt(end))
{
flag=1;
break;
}
start++;
end--;
}
if(flag==1)
System.out.println("Given string is not a Palindrome");
else
System.out.println("Given string is a Palindrome");
}
}