java program to check whether a number is pallindrome or not using recursion???????

java program to check whether a number is pallindrome or not using recursion???????

java program to check whether a number is pallindrome or not using recursion???????

View Answers

February 28, 2011 at 3:55 PM

Java check number is palindrome or not:

import java.util.Scanner;
public class NumberPalindrome
{

    public static boolean check(String s)
    {
        if(s.length() == 0 || s.length() == 1)
            return true;
        if(s.charAt(0) == s.charAt(s.length()-1))
            return check(s.substring(1, s.length()-1));
        return false;
    }

    public static void main(String[]args)
    {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter Number to check: ");
        int num=input.nextInt();
        String number = Integer.toString(num);
        if(check(number))
            System.out.println(number + " is a palindrome");
        else
            System.out.println(number + " is not a palindrome");
    }
}

Ads









Related Tutorials/Questions & Answers:
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????
Advertisements
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????
java program to compare two hashmaps and check whether they are equal or not
Check whether the number is palindrome or not
Check whether the sum of alternate digit of a number is palindrome or not.
Program to check whether two given words pronouncing same or not?
Prime number program in java
Magic number Java Program
program on factorial of a given number in java
program on factorial of a given number in java
Program to Find Cube Root of any Number without using built in function
Prime Number program in Java
To check a palindrome number?
Write a program in Java to convert Decimal number into Binary number
Program to count the number of unique words in a file using HashMap
Java Program to check Palindrome
A Java Program by using JSP
java program using control statements...
Java Program Qns using BlueJ
Check even or odd number.
java program to insert data into a file and count the number of words from the file???????
Execute the java program using one processor
ID number program
Create a java program using Java with LinkedLists
using random number
using random number

Ads