U2p10.java

import java.util.*; public class u2p10 { public static void main(String []args) { String word,rev=""; Scanner sc=new Scanner(System.in); System.out.println("Enter String:"); word=sc.nextLine(); for(int i=word.length()-1;i>=0;i--) { rev=rev+word.charAt(i); } System.out.println(rev+"\n"); if(word.compareTo(rev)==0) { System.out.println("This is palindrome String"); } else { System.out.println("This is not palindrome String"); } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.