Advertisement
GeeckoDev

pe4

Aug 6th, 2011
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int palindrom(int n)
  4. {
  5.   char str[64] = {0};
  6.   int len = sprintf(str,"%d",n), i;
  7.   for (i=0; i!=len/2; i++) if (str[i] != str[len-i-1]) break;
  8.   return i == len/2;
  9. }
  10.  
  11. int main()
  12. {
  13.   int a = 1000, b, pal = 0;
  14.   while (--a)
  15.   {
  16.     b = 1000;
  17.     while (--b)
  18.     {
  19.       if (palindrom(a*b) && a*b > pal) pal = a*b;
  20.     }
  21.   }
  22.   printf("%d\n",pal);
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement