palindrome or not
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int num=sc.nextInt();
int orginal=num;
int digit;
int reverse=0;
while(num>0){
digit=num%10;
reverse=reverse*10+digit;
num=num/10;
}
if(orginal==reverse)
{
System.out.print("is a palindrom");
}
else{
System.out.print("is a not palindrom");
}
}
}
Comments