Advertisement
Infiniti_Inter

16-I (S)

Dec 9th, 2019
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7. using System.IO;
  8.  
  9.  
  10. class MainClass
  11. {
  12.  
  13.     public static void Main(string[] args)
  14.     {
  15.  
  16.  
  17.  
  18.         using (StreamWriter fileOut = new StreamWriter(@"C:/Users/karpenkoos/desktop/output.txt"))
  19.         {
  20.             using (StreamReader fileIn = new StreamReader(@"C:/Users/karpenkoos/desktop/input.txt"))
  21.             {
  22.  
  23.                 var a = fileIn.ReadToEnd().Split(' ');
  24.                 int[] c = new int[a.Length];
  25.                 //Заполняем массив с этими числами
  26.                 for (int j = 0; j < a.Length; j++)
  27.                 {
  28.                     c[j] = int.Parse(a[j]);
  29.                 }
  30.                 var lowNums = c.Where(n => n > 0 & n % 2 == 0).OrderBy(x => x);
  31.                 foreach (var x in lowNums)
  32.                     fileOut.Write(x + " ");
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement