Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: savina.ivancheva
- * Date: 22.08.2017
- * Time: 10:06
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace MaxSequenceOf_EqualElements_Array
- {
- class Program
- {
- public static void Main(string[] args)
- {
- var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- List<int> result = new List<int>(input);
- string[] command = Console.ReadLine().Split(' ');
- while (command[0] != "even" || command[0] != "odd")
- {
- int num = int.Parse(command[1]);
- if (command[0] == "Delete")
- {
- result.Remove(int.Parse(command[1]));
- }
- else if(command[0] == "Insert")
- {
- result.Index(command[2], command[1]);
- }
- command = Console.ReadLine().Split(' ');
- }
- if (command[0] == "even")
- {
- for (int i = 0; i < result.Count; i++)
- {
- if (IsEven(result[i]))
- {
- Console.WriteLine("{0} ",result[i]);
- }
- }
- }
- else if (command[0] == "odd")
- {
- for (int i = 0; i < result.Count; i++)
- {
- if (IsEOdd(result[i]))
- {
- Console.WriteLine("{0} ",result[i]);
- }
- }
- }
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement