Search This Blog

Wednesday 19 October 2016

PALINDROME NUMBER PROGRAM

PROGRAM FOR PALINDROME NUMBER

import java.io.*;
class palindrome
{
    public static void palindrome()throws IOException
    {
     int r,rev=0;
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      System.out.println("enter the no");
      int  n=Integer.parseInt(br.readLine());
        int no=n;
        while(n>0)
        {
            r=n%10;
            rev=rev*10+r;
            n=n/10;
        }
        if(rev == no)
        {
        System.out.println("the no. is palindrome");
    }
    else
    {
        System.out.println("the no is not a palindrome");
    }
}
   
}

No comments:

Post a Comment

Make a JAVA program for a Toystore. This program suggest the toy based on the inputs users gives like age , gender , etc

 //editor used - IntelliJ IDEA package ToyStore; import javax.swing.*; import java.awt.event.*; import java.util.Scanner; //here you can edi...