Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Problem
- {
- static void Main()
- {
- int a = 0;
- int b = -1;
- for (int i = 999; i >= 100; i--)
- {
- for (int j = 999; j >= 100; j--)
- {
- a = i * j;
- if ((a == Reverse(a)) && (a > b))
- b = a;
- }
- }
- Console.WriteLine("\n{0}\n", b);
- }
- static int Reverse(int x)
- {
- int y = 0;
- while (x != 0)
- {
- y *= 10;
- y += x % 10;
- x /= 10;
- }
- return y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment