Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Threading;
  7. using System.IO;
  8. using System.Collections;
  9.  
  10. namespace ConsoleApplication5
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             int lastPalindromes = 0;
  17.             for(int x = 100; x < 999; x++)
  18.             {
  19.                 for (int y = 100; y < 999; y++)
  20.                 {
  21.                     int mul = x * y;
  22.                     if (isPalindromes(mul))
  23.                     {
  24.                         lastPalindromes = mul;
  25.                     }
  26.                 }
  27.             }
  28.             Console.WriteLine(lastPalindromes);
  29.             Console.ReadLine();
  30.         }
  31.  
  32.         static bool isPalindromes(int integer)
  33.         {
  34.             string s_i = integer.ToString();
  35.             string s2_i = new string(s_i.Reverse().ToArray());
  36.             return s_i == s2_i;
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement