Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Print_Even_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- Queue<int> input = new Queue<int>(Console.ReadLine().Split().Select(int.Parse));
- int number = 0;
- Queue<int> evenNum = new Queue<int>();
- while (input.Any())
- {
- number = input.Peek();
- if (number % 2 == 0)
- {
- evenNum.Enqueue(number);
- input.Dequeue();
- }
- else
- {
- input.Dequeue();
- }
- }
- Console.WriteLine(string.Join(", ",evenNum));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement