Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Numerics;
- using System.Text;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> numbersNew = new List<int>();
- numbersNew.AddRange(numbers);
- numbers.RemoveAll(a => a % 2 == 0);
- int evenSum = numbers.Sum();
- numbersNew.RemoveAll(a => a % 2 != 0);
- int oddSum = numbersNew.Sum();
- int output = oddSum - evenSum;
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement