Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. StreamReader fin = new StreamReader("C:\\Users\\Elev\\Documents\\Visual Studio 2010\\Projects\\fisier.txt");
  14. string linie= fin.ReadLine();
  15. fin.Close();
  16.  
  17.  
  18. //char[] sep = { ' ' };
  19. //string[] cuvinte = linie.Split(sep);
  20.  
  21. StreamWriter fout = new StreamWriter("C:\\Users\\Elev\\Documents\\Visual Studio 2010\\Projects\\afisier.txt");
  22.  
  23. foreach (string x in linie)
  24. {
  25. if(int.Parse(x)%2==0)
  26. fout.WriteLine(x);
  27. }
  28. fout.Close();
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement