Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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.  
  7. namespace ConsoleApplication5
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int ch;
  14. var l = 0;
  15. string s = Console.ReadLine();
  16. string[] w = s.Split(' ');
  17. try
  18. {
  19. foreach (var el in w)
  20. {
  21. ch = int.Parse(el);
  22. if (ch > 20 && ch < 40)
  23. {
  24. l = ch;
  25. Console.Write(l);
  26. Console.Write(" ");
  27. }
  28. }
  29. }
  30. catch (System.FormatException e)
  31. {
  32. Console.WriteLine(e.Message);
  33. }
  34. Console.WriteLine(" ");
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement