Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. List<int> a = new List<int>();
  2. using (StreamReader fs = new StreamReader("1111.txt"))
  3. {
  4. while (true)
  5. {
  6. string temp = fs.ReadLine();
  7. if (temp == null) break;
  8. a.Add(Convert.ToInt32(temp)); //считываем и заносим в список
  9. }
  10. for (int i = 0; i < a.Count; i++)//проверяем на повторение
  11. {
  12. if (a[i] == a[i + 1])
  13. {
  14. a.RemoveAt(a[i + 1]);
  15. }
  16. }
  17. for (int i = 0; i < a.Count; i++)//вывод
  18. {
  19. Console.WriteLine(a[i]);
  20. }
  21.  
  22. }
  23. Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement