Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Program to display palindrome numbers between some range

Have Programming Question? Ask it here!
 
 
 


Sowndarya
Program to display palindrome numbers between some range
1 Answer(s)      2 years and 11 months ago
Posted in : Java Beginners


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


Advertisement
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
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
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
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
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
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
palindrome
palindrome  program to find the given string is palindrome...]; } if(st.equalsIgnoreCase(reversedSt)){ System.out.println("String 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 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
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
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
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
Java program - convert words into numbers?
Java program - convert words into numbers?   convert words into numbers?   had no answer sir
java palindrome
java palindrome  sir i need java program to print 1)integer palindrome 2)string palindrome
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
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>
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
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
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
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
Palindrome Number Example in Java
or not. If the given number is larger, then it will display a message "Out of range... Palindrome Number Example in Java    ... the palindrome number and how to determine any number is palindrome or not. First of all we
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
MySQL range
some range. To fire query we must have some data into a table therefore we... MySQL range       May times the programmer needs to find out some specific data which lies
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
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
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
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
palindrome - Java Beginners
palindrome  determines whether or not it is a palindrome. if the number is not five... == digit4)){ System.out.print("Number is palindrome!"); } else{ System.out.println("Number is not palindrome!"); } } catch(Exception e  
palindrome - Java Beginners
palindrome  use array to write a program that checks if a word is palindrome. A word is said to be palindrome if it reads the same forward.... Words like "tooth" and "feet" are not palindromes. The program prompts the user
palindrome - Java Beginners
palindrome in java code  I need an example of palindrome in Java ...;& (digit2 == digit4)){ System.out.print("Number is palindrome!"); } else{ System.out.println("Number is not palindrome!"
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
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
Exercise - Palindrome
Java: Exercise - Palindrome Problem Write a method which returns true if the string parameter is a palindrome. A palindrome is any "word" which... return false if the argument is not a palindrome. Signature
Numbers
numbers, you will usually use decimal numbers in your Java source program... Java NotesNumbers Two kinds of numbers. There are basically two kinds of numbers in Java and most other programming languages: binary integers (most
palindrome - Java Beginners
palindrome  Write a program to find whether a given string is a palindrome or not  Hi Friend, Try the following code: import java.util.*; public class CheckPalindrome{ public static void main(String[] args
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
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
To find palindrome no in a file - Java Beginners
To find palindrome no in a file  hi all i am having a problem...I wanted to write one java program where i have to count the no of palindrome in a file. I tried it with my own but not able to get result.pls help me out  
Mysql Time Range
Mysql Time Range      ..., but helps you to assign values to Time columns using either strings numbers. Understand with Example The Tutorial illustrate an example from 'Mysql Time Range
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
palindrome - Java Beginners
palindrome  import java.io.*; class Palindrome...; } } this program is showing errors while compilation. it says identifier expected in 4th line of the program... help me out of it   
Advertisements
 

 

 

DMCA.com