Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  palindrome
Language: JAVA
Code:
import java.io.*;
import java.lang.*;
class PalindromeA{
     public static void main(String args[]){
          int p=0;
          int n=args[0].length();
          for(int i=0;i<n;i++){
               if(args[0].charAt(i)!=args[0].charAt(n-i-1))
               p=1;
          }
          if(p==0)
               System.out.println("the given staring is a palindrome");
          else
               System.out.println("the given string is not a palindrome");
     }
}
Comments: