public class Task3 {
public static void main(String[] args) {
int x;
for (int i = 200; i <= 299; i++) {
x = i;
x -= 3;
x = reverseInt(x);
if (i / 2 == x) {
System.out.println("i = " + i);
return;
}
public static int reverseInt(int input) {
long reversedNum = 0;
long input_long = input;
while (input_long != 0) {
reversedNum = reversedNum * 10 + input_long % 10;
input_long = input_long / 10;
if (reversedNum > Integer.MAX_VALUE || reversedNum < Integer.MIN_VALUE) {
throw new IllegalArgumentException();
return (int) reversedNum;
public class Task3 {
public static void main(String[] args) {
int x;
for (int i = 200; i <= 299; i++) {
x = i;
x -= 3;
x = reverseInt(x);
if (i / 2 == x) {
System.out.println("i = " + i);
return;
}
}
}
public static int reverseInt(int input) {
long reversedNum = 0;
long input_long = input;
while (input_long != 0) {
reversedNum = reversedNum * 10 + input_long % 10;
input_long = input_long / 10;
}
if (reversedNum > Integer.MAX_VALUE || reversedNum < Integer.MIN_VALUE) {
throw new IllegalArgumentException();
}
return (int) reversedNum;
}
}