PALINDROME NUMBER IN JAVA || BLUEJ
***************************
import java.util.Scanner;
public class palindrome_number
{
public static void main (String args []) {
Scanner sc = new Scanner(System.in); int s = 0, num, rev, num1 ; System.out.println ("ENTER A NUMBER");
num = sc.nextInt ();
num1 = num;
while (num! = 0)
{
rev = num% 10;
s = s * 10 + rev;
num = num / 10;
}
if (s == num1)
System.out.println ("IT IS PALINDRONE NUMBER");
else
System.out.println ("IT IS NOT A PALINDRONE NUMBER");
}
}
***************************
0 Comments