Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication10
- {
- class Program
- {
- public static bool Func(int num)
- {
- int ldig = num % 10;
- int dig = 0;
- int nnum = num;
- while (nnum != 0)
- {
- dig++;
- nnum /= 10;
- }
- if (num / 100 == 0)
- {
- if (num / 10 == 0)
- return true;
- else
- {
- if ((num %10) == (num/10))
- {
- return true;
- }
- else
- return false;
- }
- }
- num /= 10;
- return ldig/* rightest digit */ == (num / Math.Pow(10, dig-2))/* leftest digit */ && Func((num % (int)Math.Pow(10, dig - 2)));
- }
- static void Main(string[] args)
- {
- Console.WriteLine(Func(int.Parse(Console.ReadLine())));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement