Advertisement
sivancheva

ChangeList

Aug 22nd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. /*
  2. * Created by SharpDevelop.
  3. * User: savina.ivancheva
  4. * Date: 22.08.2017
  5. * Time: 10:06
  6. *
  7. * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8. */
  9. using System;
  10. using System.Linq;
  11. using System.Collections.Generic;
  12.  
  13. namespace MaxSequenceOf_EqualElements_Array
  14. {
  15. class Program
  16. {
  17. public static void Main(string[] args)
  18. {
  19. var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  20.  
  21. List<int> result = new List<int>(input);
  22.  
  23. string[] command = Console.ReadLine().Split(' ');
  24.  
  25. while (command[0] != "even" || command[0] != "odd")
  26. {
  27. int num = int.Parse(command[1]);
  28.  
  29. if (command[0] == "Delete")
  30. {
  31. result.Remove(int.Parse(command[1]));
  32. }
  33.  
  34. else if(command[0] == "Insert")
  35. {
  36. result.Index(command[2], command[1]);
  37. }
  38.  
  39. command = Console.ReadLine().Split(' ');
  40.  
  41. }
  42.  
  43. if (command[0] == "even")
  44. {
  45. for (int i = 0; i < result.Count; i++)
  46. {
  47. if (IsEven(result[i]))
  48. {
  49.  
  50. Console.WriteLine("{0} ",result[i]);
  51. }
  52.  
  53. }
  54.  
  55. }
  56. else if (command[0] == "odd")
  57. {
  58. for (int i = 0; i < result.Count; i++)
  59. {
  60. if (IsEOdd(result[i]))
  61. {
  62.  
  63. Console.WriteLine("{0} ",result[i]);
  64. }
  65.  
  66. }
  67.  
  68. }
  69.  
  70. Console.Write("Press any key to continue . . . ");
  71. Console.ReadKey(true);
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement