Program to display palindrome numbers between some range

Program to display palindrome numbers between some range

Hi!I want a java program to display palindrome numbers between 100 to 1000.can you please explain me the logic with an example

View Answers

May 9, 2011 at 4:32 PM

import java.util.*;

public class NumberPalindrome {
    static ArrayList<Integer> list = new ArrayList<Integer>();
public static   ArrayList<Integer> findPalindromes(){
             for (int i=100; i<=1000; i++){
             Integer in=new Integer(i);
             String number=in.toString();
             int index1=0;
             int index2=number.length()-1;
             char x=number.charAt(index1);
             char y=number.charAt(index2);
             while (index2-index1>=0){
             if(x!=y)
             break;
             if (index2-index1==0 || index2-index1==1)
             list.add(i);
             index1++;
             index2--;
             x=number.charAt(index1);
             y=number.charAt(index2);
             }
          }
          return list;
       }
    public static void main(String[] args) {
   ArrayList l=findPalindromes();
   for(int i=0;i<l.size();i++){
       System.out.println(l.get(i));
   }
    }
}









Related Tutorials/Questions & Answers:
Program to display palindrome numbers between some range
Program to display palindrome numbers between some range  Hi!I want a java program to display palindrome numbers between 100 to 1000.can you please explain me the logic with an example   import java.util.*; public
print the even numbers between the range 100-200
print the even numbers between the range 100-200  Q ?write an application that print out the even numbers between the range 100-200 ? 1- which aer... prints out the even numbers between the range of 100 and 200 and then determine
Advertisements
write an application that print out the even numbers between the range 100-200
write an application that print out the even numbers between the range 100-200   write an application that print out the even numbers between... and determine the even numbers between them. class EvenNumbers { public static
Finding all palindrome prime numbers - Java Beginners
Finding all palindrome prime numbers  How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded
palindrome
palindrome  write a program to print palindrome numbers between 500 to 700
Write a program to list all even numbers between two numbers
Write a program to list all even numbers between two numbers... Numbers Example in Java: Here you will learn to write a program for listing out all the even numbers between two numbers. For this first create a class named
Generating random numbers in a range with Java
Generating random numbers in a range with Java  Generating random numbers in a range with Java
Prime Numbers from range
Prime Numbers from range  how to find prime numbers in a given range which are palindromes??   Hi Friend, Try the following code: import java.util.*; public class PrimeAndPalindrome { static final int MAXNUMBER
Listing all even numbers between two numbers
the numbers. Check the tutorial Write a program to list all even numbers between two...Listing all even numbers between two numbers  Hi, How to write code to list all the even numbers between two given numbers? Thanks   Hi
Palindrome program in Java
Palindrome program in Java helps programmers to determine if a number.... The logic used in Java program behind finding a number or sting is palindrome... entered is palindrome or not. If the given number is larger, then it will display
Palindrome
Palindrome  program to verify palindrome
Prime numbers in Java between 1 and 100
Prime numbers in Java between 1 and 100  Hi, How to display prime numbers in java between 1 and 100? Thanks   Hi, Prime numbers... numbers in java between 1 and 100: package net.roseindia; /* * This program
Find Numbers which are palindrome and prime
Find Numbers which are palindrome and prime In this section, you will learn how to find the numbers from 1 to 500 which are palindrome and prime. To compute...() of boolean type. Now the list contains all the numbers which are palindrome
How to list even numbers between 1 and 100?
How to list even numbers between 1 and 100?  Hi, I Java to check if a number is even? How to list even numbers between 1 and 100? Thanks  ... the numbers between 1 and 100 for (int i=1;i <=num ; i++){ if(i%2==0
generate random numbers and display the largest
generate random numbers and display the largest  Hi, I am using netbeans so if someone could help me with an answer in that form i'd appreciate it. Write a method to find the largest value in an array. Write a program that takes
mysql difference between two numbers
mysql difference between two numbers  How to get total bate difference between two dates for example 1/01/2012 and 1/02/2012 in MYSQL?   ... between two date. The syntax of DATEDIFF is .. SELECT DATEDIFF('2012-01-31 23:59
palindrome
palindrome  program to find the given string is palindrome or not   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.util.... is palindrome"); } else{ System.out.println("String is not palindrome
Java program - convert words into numbers?
Java program - convert words into numbers?   convert words into numbers?   had no answer sir
SQL display date in between query
SQL display date in between query  how to get ( 15 march 2011) and (15/03/2011) output using SQL
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala  Hi, How to Generate random number between two numbers in Scala? Thanks   Hi, Following code can be used for generating random number in scala: val rand = new
Generate random number between two numbers in Scala
Generate random number between two numbers in Scala  Hi, How to Generate random number between two numbers in Scala? Thanks   Hi, Following code can be used for generating random number in scala: val rand = new
Java Program to check Palindrome
Java Program to check Palindrome In this section, you will learn about..., then it is called palindrome number otherwise it is not. Description of program : With the help of this program, we are going to check whether the number is palindrome
palindrome
palindrome  how to write in string of palindrome?   import... is palindrome"); } else{ System.out.println("String is not palindrome
palindrome
palindrome  how to write in string of palindrome   import... is palindrome"); } else{ System.out.println("String is not palindrome
PALINDROME
PALINDROME  how to find palindrome of a number WITHOUT using a string... == reversedNumber){ System.out.print("Number is palindrome!"); } else{ System.out.println("Number is not palindrome!"); } } catch(Exception e){ System.out.println(e
prime palindrome
prime palindrome  Hi I want to write a program that ask a user to input a number, the program then list all the prime numbers that are palindrome below the number entered. In pascal language Thanks
display dates between two dates - Java Beginners
display dates between two dates  hi can any one help me to writing this code, i need to store the dates between to dates so that i can retrive the data from the db using theses dates. its urgent pls tell me as possible
The Array Palindrome Number in Java
The Array Palindrome Number in Java       This is a Java simple palindrome number program... program. The array palindrome number arrange the array number. This session
java palindrome
java palindrome  sir i need java program to print 1)integer palindrome 2)string palindrome
to write a program to display the employee details..
to write a program to display the employee details..  To dipslay... running this program the new window has to be opened asking us to enter all...   not this one actually i wnat a very small program that displays all
How do I change the while loop in this code to the range with range list style display page for a resultSet() in jsp?
How do I change the while loop in this code to the range with range list style display page for a resultSet() in jsp?  this is count record code <%@ page language="java" import="java.sql.*" %> <html> <head>
palindrome - Java Beginners
palindrome  example of java program if it is a palindrome or not palindrome   Hi friend, Example to check the number is a palindrome...){ System.out.print("Number is palindrome!"); } else
numbers
numbers  Write a program that read 15 integers between 0 and 6 and a method to search, displays and returns the number that has the highest occurrence. Prompt the user if the number is not within this range.   Hello
Palindrome Number Example in Java
is palindrome or not. If the given number is larger, then it will display a message "Out of range!".  Here is the code of this program... Palindrome Number Example in Java    
To check a palindrome number?
To check a palindrome number?  program to check a number is palindrome or not using recursion?(wihout converting to string
MySQL range
data lying between some range. To fire query we must have some data into a table... MySQL range       May times the programmer needs to find out some specific data which lies
Create a multi-thread program that calcualtes values for a list of numbers
Create a multi-thread program that calcualtes values for a list of numbers  Write a multithreaded program that calculates various statistical values for a list of numbers. This program will be passed a series of numbers
program to display the first ten terms of the series
program to display the first ten terms of the series  Write a program to display the first ten terms of the following series : 1) 1,-3,5,-7,9..... 2) 3,6,12,24..... 3) 2,5,10,17....... 4) 0,1,2,3,6............ 5) 0,3,8,15
prime palindrome
prime palindrome  Hi I want to write a program in pascal that ask a user to input a number, the program then list all the prime number that are palindrome below the number entered. thks
ModuleNotFoundError: No module named 'palindrome'
ModuleNotFoundError: No module named 'palindrome'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'palindrome' How to remove the ModuleNotFoundError: No module named '
display diffrence between two dates in a text box - JSP-Servlet
display diffrence between two dates in a text box  i have these set of codes // String di=request.getParameter("timestamp2"); String d2=request.getParameter("timestamp3"); SimpleDateFormat formater=new SimpleDateFormat("dd-mm
how to write a program in java to print numbers in equalateral triangle
how to write a program in java to print numbers in equalateral triangle  the output must be 1 324 76589   Here is an example of pattern 1 2 3 4 5 6 7 8 9 Example: public class NumberTriangle{ public
can some help out on wrting this program. - Java Beginners
can some help out on wrting this program.  Write a Java program... and the price of the order computed to your program. NOTE: The first number on the file
Ordinal Numbers Series Program in Java
Ordinal Numbers Series Program in Java An ordinal number shows a relative position, e.g., 1st, 2nd, 3rd, 4th,etc. In other words, ordinal numbers series... are going to display first 10 ordinal numbers. Here is the code: public
Write a program to display grade message according to the marks
Write a program to display grade message according to the marks  pls give d answer how to Write a program to display grade message according to the marks     Write a program to display grade message according
Program to read the text from a file and display it on a JFrame.
Program to read the text from a file and display it on a JFrame.  import javax.swing.*; import java.io.*; import java.lang.*; import java.awt.*; class MegaViewer1 extends JFrame { JTabbedPane jtp1=new JTabbedPane
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
Java Find Automorphic numbers
the automorphic numbers between 1 and 1000. Automorphic numbers are the numbers... of number 6 at the end. Here we are going to find the automorphic numbers between 1...("Automorphic Numbers between 1 and 1000 are: "); for (long i = 1; i < 1000; i
complete the code (palindrome) - Java Beginners
complete the code (palindrome)  Write a program that checks if a word is palindrome. A word is said to be palindrome if it reads the same forward... to left. Words like "tooth" and "feet" are not palindromes. The program prompts
ModuleNotFoundError: No module named 'pp-palindrome'
ModuleNotFoundError: No module named 'pp-palindrome'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pp-palindrome' How to remove the ModuleNotFoundError: No module named

Ads