Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string str;
- string result;
- Console.WriteLine("Напишите строку ");
- str = Console.ReadLine();
- if (str.Length % 2 != 0) // определяем четное число символов в строке или нет
- {
- result = str.Remove((str.Length / 2), 1);// метод Remove удаляет один символ с индексом
- }
- else
- {
- result = str.Remove((str.Length / 2) - 1, 2);
- }
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement