Subject description:
A positive integer, if read from left to right (sequence number referred to as positive) and read from right to left (reverse call number) is the same, such a number is called palindrome. Input two integers m and n (m <n), the output interval between the palindrome [m, n].
Input:
Enter two positive integers m and n, input to ensure that m <n.
Output:
In ascending order, the output m number of palindromic between n, the number behind each a space.
Sample input:
100 200
Sample output:
101 111 121 131 141 151 161 171 181 191
code:
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int m=input.nextInt();
int n=input.nextInt();
int sum=0;
for(int i=m;i<=n;i++)
{
int x=i;
while(x!=0)
{
sum=sum*10+x%10;
x/=10;
}
if(sum==i)
System.out.print(i+" ");
sum=0;
}
input.close();
}
}