Advertisement
ramsess

Prob_5_Weather_Forecast Version 2

Jun 4th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Prob_5_Weather_Forecast
  4. {
  5.     class Prob_5_Weather_Forecast
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string input = Console.ReadLine( );
  10.            
  11.             try
  12.             {
  13.                 sbyte.Parse(input);
  14.                 Console.WriteLine("Sunny");
  15.             }
  16.             catch (Exception)
  17.             {
  18.                 try
  19.                 {
  20.                     int.Parse(input);
  21.                     Console.WriteLine("Cloudy");
  22.                 }
  23.                 catch (Exception)
  24.                 {
  25.                     try
  26.                     {
  27.                         long.Parse(input);
  28.                         Console.WriteLine("Windy");
  29.                     }
  30.                     catch (Exception)
  31.                     {
  32.                         try
  33.                         {
  34.                             decimal.Parse(input);
  35.                             Console.WriteLine("Rainy");
  36.                         }
  37.                         catch (Exception)
  38.                         {
  39.                             Console.WriteLine("");
  40.                         }
  41.                     }
  42.                 }
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement