Palindrome number program in java
Lets write the program to check a number whether it is Palindrome or not.
CODE:
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
Find top programming interview questions and answers
ReplyDelete10 Most Commonly Asked Interview Questions and Answers in any field
Embedded using C Interviews Questions and Answers