Computer Science, asked by aalindrisas, 11 months ago

how to print in java using a do while loop to print palindrome no.​

Answers

Answered by colourmedia
3

Answer:

import java.util.*;

class palindrome

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

int n,rev=0,sum=0,m;

System.out.println("Enter a number");

n=sc.nextInt();

m=n;

while(n>0)

{

rev=n%10;

sum=sum*10+rev;

n=n/10;

}

if(n==m)

System.out.println("Palindrome number");

else

System.out.println("Non-palindrome number");

}

}

Explanation:

Similar questions