Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _08.EvenNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- string str = Console.ReadLine();
- str = str.Remove(str.Trim().Length - 1);
- string[] input = str
- .Split()
- .ToArray();
- int[] result = input
- .Where(x => x.All(char.IsDigit))
- .Select(int.Parse)
- .Where(x => x % 2 == 0)
- .ToArray();
- if (result.Length == 0)
- {
- Console.WriteLine(-1);
- }
- else
- {
- int number = result
- .Max();
- Console.WriteLine(number);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement