Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace srdr
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToList();
- if (numbers.All(x=>x%2==0))
- {
- Console.WriteLine("All numbers are even.");
- }
- else if (numbers.All(x=>x%2!=0))
- {
- Console.WriteLine("All numbers are odd.");
- }
- else
- {
- Console.WriteLine("The list contains both even and odd numbers.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement