Recent Posts

Friday 13 June 2014

04:13
1

Palindrome number program in java


Lets write the program to check a number whether it is Palindrome or not.

CODE:


//Copyright @author Harpreet Sandhu
import java.util.*;
public class palindrome
{ public static void main(String s[])
{ int temp=0,d=0,r=0;
temp=t;
Scanner c= new Scanner(System.in);
int t=c.nextInt();
while(t>0)
{d=t%10;
 r=r*10+d;
 t=t/10;
 }
 System.out.println(" reverse of no. is "+r);
 if(r==temp)
 System.out.println("NO. is palindrome");
 else
 System.out.println("no. is not paliundrome");
 }}

OUTPUT :  it will be according to your program

1 comments: