Информатика, вопрос задал BamaBoy , 9 лет назад

Помогите написать программу на C# 
Написать программу, удаляющую из записи числа все чётные цифры.

Ответы на вопрос

Ответил kitchenrecords
0
static class Program
{
    public static IEnumerable<uint> Digits(this uint X, bool Reverse = true)
    {
        do { yield return X % 10; } while ((X /= 10) != 0);
    }


    static uint ToUnsignedInt32(this IEnumerable<uint> Digits)
    {
        return Digits.Reverse().Aggregate((a, d) => a * 10 + d);
    }


    static void Main()
    {
        Console.WriteLine(
            uint.Parse(Console.ReadLine())
                .Digits()
                .Where(d => d % 2 == 1)
                .ToUnsignedInt32());
                
        Console.ReadKey();
    }
}
Новые вопросы