Created
September 28, 2023 22:21
-
-
Save 969rishi/f2536b4afac109f13c423ef77c580cbc to your computer and use it in GitHub Desktop.
Palindrome Word Solution in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Online Java Compiler. | |
Code, Compile, Run and Debug java program online. | |
Write your code in this editor and press "Run" button to execute it. | |
*******************************************************************************/ | |
public class Main | |
{ | |
public static void main(String[] args) { | |
String input = "manonam"; | |
String originalInput = input; | |
String reverseString = ""; | |
for (int i = input.length()-1; i > -1; i--) { | |
reverseString = reverseString + input.charAt(i); | |
} | |
System.out.println(reverseString ); | |
if (originalInput.equalsIgnoreCase(reverseString)) { | |
System.out.println(originalInput+" is Palindrome Word ✓✓✓"); | |
}else System.out.println(originalInput+" is Not a Palindrome Word XXX"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment