Monday, August 9, 2010

Article | Java Program To Check Whether a String is Pallindrome or not without using any string functions

Java Program To Check Whether a String is Pallindrome or not without using any string functions

import java.io.*;
class Pallindrome
{
public static void main(String args[])
{
String ch="";
int f=0;
System.out.print(" Enter A String : ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
ch=br.readLine();
}catch(Exception e){}
int n=ch.length();
for(int i=0; i <(n/2) ; i++)
{
if(ch.charAt(i)==(ch.charAt(n-i-1)))
{
f=1;
break;
}

}
if(f==1)
System.out.println(" Is A Pallindrome ");
else
System.out.println(" Is Not A Pallindrome ");
}
}

Loading...

Comments :

0 comments to “ Java Program To Check Whether a String is Pallindrome or not without using any string functions ”

Subscribe

Enter your email address:

Followers

Chicklets

My Zimbio