Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int palindrom(int n)
- {
- char str[64] = {0};
- int len = sprintf(str,"%d",n), i;
- for (i=0; i!=len/2; i++) if (str[i] != str[len-i-1]) break;
- return i == len/2;
- }
- int main()
- {
- int a = 1000, b, pal = 0;
- while (--a)
- {
- b = 1000;
- while (--b)
- {
- if (palindrom(a*b) && a*b > pal) pal = a*b;
- }
- }
- printf("%d\n",pal);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement