Finding the largest palindrome of the product of two three digit numbers problem
So on Project Euler the Problem 4 states the following: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the largest palindrome made from the product of two 3-digit numbers. I have tried the following: #include <stdio.h> #include <stdlib.h> int check(int result) { char b[7]; sprintf(b, "%d", result); if (b[0] == b[5] && b[1] == b[4] && b[2] == b[3]) { return 1; } else { return 0; } } int main () { int i; int g; int final; for (i = 999; i > 99; i--) { for (g = 999; g > 99; g--) { if (check(g*i) == 1) { final