12 comments:

  1. import java.util.Scanner;

    class Test{

    public static void main(String ar[])
    {

    Scanner sc=new Scanner(System.in);
    int num,hold=0,rev=0,orignum;
    System.out.println("Enter Number to check if its palindrome or not?");
    num=sc.nextInt();
    orignum=num;
    while (num > 0)
    {
    hold=num%10;
    rev=(rev*10)+hold;
    num/=10;
    }
    if(orignum==rev)
    System.out.println("Palindrome Number");
    else
    System.out.println("Not A Palindrome Number");
    }
    }

    ReplyDelete
  2. import java.util.Scanner;

    class Test
    {

    public static void main(String ar[])
    {
    long temp_number,number,rev_number=0;
    System.out.print("Enter the number: ");
    Scanner o= new Scanner(System.in);
    number=o.nextInt();
    temp_number=number;
    while(temp_number!=0)
    {
    rev_number=rev_number*10+(temp_number%10);
    temp_number/=10;
    }
    if(rev_number==number)
    System.out.print("Number is palindrome");
    else
    System.out.print("Number is not palindrome");


    }
    }

    ReplyDelete
  3. import java.util.Scanner;
    class Palindrome
    {
    public static void main(String ar[])
    {
    int Number,RNumber=0,OriNumber;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the Number you want check for Palindrome");
    Number=scan.nextInt();
    OriNumber=Number;
    while(Number>0)
    {

    RNumber=RNumber*10+(Number%10);
    Number=Number/10;

    }
    if(OriNumber==RNumber)
    {
    System.out.println("This Number "+OriNumber+" is palindrome");
    }
    else
    {
    System.out.println("This Number "+OriNumber+" is not palindrome");
    }
    }
    }

    ReplyDelete
  4. import java.util.Scanner;
    import java.lang.Math;
    class Palindrome
    {
    public static void main(String Args[])
    {
    System.out.println("enter the integer");
    Scanner sc=new Scanner(System.in);
    int num=sc.nextInt();
    int rev_num=0;
    int number=num;
    while(num>0)
    {
    int digit=num%10;
    rev_num=rev_num*10+digit;
    num/=10;
    }
    if(number==rev_num)
    {
    System.out.println(rev_num+" is palindromic number");
    }
    else
    System.out.println(rev_num+" is not palindromic number");
    }
    }

    ReplyDelete
  5. $num1=$_POST["num"];
    $temp=$num1;
    $reverse=0;
    while($temp>=1)
    {
    $reverse=$reverse*10+$temp%10;
    $temp/=10;
    }
    if($reverse==$num1)
    echo "Palindrome
    ";
    else
    echo "Not palindrome";

    ReplyDelete
  6. 12.
    import java.util.Scanner;
    class A
    {
    public static void main(String args[])
    {
    Scanner obj=new Scanner(System.in);
    int num;
    num=obj.nextInt();
    int temp;
    temp=num;
    int remainder;
    int reverse=0;
    while(num>0)
    {
    remainder=num%10;
    reverse=reverse*10+remainder;
    num/=10;
    }
    if(temp==reverse)
    System.out.println("yes it is a palindrome number");
    else
    System.out.println("no");
    }
    }

    ReplyDelete
  7. import java.util.Scanner;
    public class pallindrome
    {
    public static void main(String ar[])
    {
    Scanner num = new Scanner(System.in);
    int reverseno = 0 , remainder , no , temp;
    System.out.println("Enter the number to be reversed");
    no = num.nextInt();
    temp = no;
    while(no>0)
    {
    remainder = no % 10;
    reverseno = reverseno*10+remainder;
    no/=10;
    }
    if(reverseno == temp)
    System.out.println("the number is pallindrome");
    else
    System.out.println("the number is not pallindrome");
    }
    }

    ReplyDelete
  8. import java.util.Scanner;
    class Pallindrome{
    public static void main(String ar[]){
    Scanner obj=new Scanner(System.in);
    int num,num1,rev=0;
    System.out.println("enter the number ");
    num=obj.nextInt();
    num1=num;
    while(num1!=0){
    rev=rev*10;
    rev=rev+num1%10;
    num1=num1/10;
    }
    System.out.println("reverse of number is"+rev);

    if(num==rev)
    System.out.println("pallindrome");
    else
    System.out.println("not pallindrome");
    }
    }

    ReplyDelete
  9. import java.util.Scanner;
    class Pallindrome1{
    public static void main(String ar[]){
    int number,remainder=0,i,digit,numbercopy=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("ENTER A NUMBER");
    number=scan.nextInt();
    numbercopy=number;
    while(number!=0)

    {
    digit=number%10;
    remainder=(remainder*10)+digit;
    number=number/10;}

    {
    if (numbercopy==remainder)
    System.out.println("It is pallindrome");
    else
    System.out.println("It is not pallindrome");}
    }
    }

    ReplyDelete
  10. import java.util.Scanner;

    class Palindrome{
    public static void main(String ar[]){
    int num,temp=0,reverse=0,n=1;

    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the number:");
    num=scan.nextInt();
    temp=num;
    while(num>0){
    n=num%10;
    reverse=(reverse*10)+n;
    num=num/10;
    }
    System.out.println("The reverse no. is:"+reverse);
    if(num==reverse)
    System.out.println("It is a Palindrome!");
    else
    System.out.println("It is not a Palindrome!");
    }
    }

    ReplyDelete

  11. import java.util.*;
    class Palin{
    public static void main(String ar[]){
    Scanner s=new Scanner(System.in);
    int n,n1=0,num;

    System.out.println("enter the no: ");
    n=s.nextInt();
    num=n;
    while(n>0)
    {
    n1=n1*10+(n%10);
    n=n/10;
    }
    if(num==n1)
    {
    System.out.println("the no. is palindrome");
    }
    else
    {
    System.out.println("the no. is not palindrome");
    }
    }
    }

    ReplyDelete
  12. package com.example.myapplication;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.TextView;

    public class Palindrome extends Activity {

    int r,n,sum,temp;
    Button bt;
    TextView tv;
    EditText et;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.palindrome);

    bt=findViewById(R.id.btPalindrome);
    tv=findViewById(R.id.tvPalindrome);
    et=findViewById(R.id.etpalindrome);

    bt.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    n=Integer.parseInt(et.getText().toString());
    temp=n;

    while (n >0) {
    r = n % 10; //to get remender
    sum = (sum * 10) + r;
    n = n / 10;


    }
    //tv.setText("Result=" +sum);
    if (temp == sum) {
    tv.setText("Is A Palindrome");
    } else{
    tv.setText("Is Not A Palindrome");
    }

    }
    });
    }
    }

    ReplyDelete