Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication4;
- import java.util.Scanner;
- /**
- *
- * @author pclab
- */
- public class JavaApplication4 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner kb = new Scanner(System.in);
- String word,rev="";
- int len, i;
- System.out.println("Enter any word ");
- word=kb.nextLine();
- len=word.length();
- for(i=len-1;i>=0;i--)
- {
- rev=rev+word.charAt(i);
- }
- System.out.println("The word reversed is "+rev);
- if (word.equals(rev))
- System.out.println("Yes palindrome");
- else
- System.out.println("No palindrome");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement