Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 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.WriteLine(l);
  26.                     }
  27.                 }
  28.             }
  29.             catch (System.FormatException e)
  30.             {
  31.                 Console.WriteLine(e.Message);
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement