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 ConsoleApplication3
- {
- class Program
- {
- public static string Numstr, Invertstr = "";
- static void Main(string[] args)
- {
- }
- public static void ReadAndCheck()
- {
- Numstr = Console.ReadLine();
- for (var i = 0; i < Numstr.Length - 1; i++)
- Invertstr += Numstr.Substring(Numstr.Length - i, 1);
- if (Numstr == Invertstr)
- {
- Console.WriteLine("Число является палиндромом");
- Environment.Exit(0);
- }
- else MakePalindrom();
- }
- public static void MakePalindrom()
- {
- int num;
- while (true)
- {
- string one_part = null, two_part = null;
- num = int.Parse(Numstr) + int.Parse(Invertstr);
- if (num.ToString().Length % 2 == 0)
- {
- for (var i = 0; i < num.ToString().Length/2; i++)
- one_part += num.ToString().Substring(i);
- for (var i = 0; i < num.ToString().Length / 2; i ++)
- two_part += num.ToString().Substring(i + 2);
- if (one_part == two_part)... // завтра продолжу отсюда
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement