Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Task03
- {
- class Task03
- {
- static void Main(string[] args)
- {
- uint m = uint.Parse(Console.ReadLine());
- uint n = uint.Parse(Console.ReadLine());
- List<uint> evenNumbers = new List<uint>();
- if ((0 < m) && (m < n) && (n < 2000000000))
- {
- for (uint i = m; i <= n; i++)
- {
- if (i % 2 == 0)
- evenNumbers.Add(i);
- }
- uint sum = 0;
- int count = 0;
- foreach (var item in evenNumbers)
- {
- sum += item;
- count++;
- }
- decimal result = sum / count;
- Console.WriteLine(result);
- }
- else
- Console.WriteLine("Bad Input!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment