Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- var numbers = Console
- .ReadLine()
- .Split(" ")
- .Select(int.Parse)
- .ToArray();
- var queue = new Queue<int>();
- foreach(var num in numbers)
- {
- queue.Enqueue(num);
- }
- var count=0;
- while(queue.Count>count)
- {
- var num = queue.Dequeue();
- if(num%2==0)
- {
- count++;
- queue.Enqueue(num);
- }
- }
- Console.WriteLine(String.Join(", ", queue));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement