The Program was complied using Netbeans IDE.
PROGRAM:
OUTPUT:
Enter the String
PROGRAM:
package palindrome; import java.io.*; public class palindrome { public static void main(String[] args)throws IOException { BufferedReader st=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the String "); String str=st.readLine(); String s=""; for(int i=(str.length())-1;i>=0;i--) s=s+str.charAt(i); if(s.equals(str)) System.out.println(str+" is Palindrome "); else System.out.println(str+" is not a Palindrome"); } }
OUTPUT:
Enter the String
aga
aga is Palindrome
aga is Palindrome
0 comments:
Post a Comment
If You Are Asking Some Question On This Comment Then Click On Subscribe by email Link