Hi everyone i'm newbie here in bytes and a newbie in programing i need your help! can you correct my program when my program compile its say Process completed. but when i put a Word and Run my program does not show an output what is the problem?
Code:
import javax.swing.*;
public class Palindrome
{
public static void main(String[] args)
{
String A;
int i,palindrome=1;
A=JOptionPane.showInputDialog(null,"Enter a Word");
for(i=0;i<A.length()/2;++i)
{
if(A.charAt(i)!=A.charAt(A.length())-i-1)
{
palindrome=0;break;
}
if(palindrome==1)
System.out.println("The Word "+A+" is a Palindrome");
else
System.out.println("The Word "+A+" is not a Palindrome");
}
}
}
Comment