/*
* pe4.c
* https://mind.kittttttan.info/c/pe4
*/
/* https://mind.kittttttan.info/c/palindrome */
#include "palindrome.h"
#include <stdio.h>
void pe4(int first, int last) {
int m, x, y, xy;
m = 0;
for (x = first; x < last; ++x) {
for (y = x; y < last; ++y) {
xy = x * y;
if (xy > m && is_palindrome(xy)) {
m = xy;
}
}
}
if (m) {
printf("Max palindrome is %d for x * y (%d <= x,y < %d)\n", m, first, last);
} else {
printf("No palindromes are found for x * y (%d <= x,y < %d)\n", first, last);
}
}
int main(void) {
int m, n;
puts("Problem 4:");
while (1) {
if (scanf("%d %d", &m, &n) != 2) {
scanf("%*s");
puts("Input 2 Numbers.");
} else {
if (!m && !n) {
break;
}
pe4(m, n);
}
}
return 0;
}