Advertisement
radidim

try-catch (C# Shell App Paste)

Sep 25th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2.  
  3.  namespace Dcoder
  4.  {
  5.     public class Program
  6.     {
  7.         public static void Main()
  8.         {
  9.             try
  10.             {
  11.                 String input = Console.ReadLine();
  12.                 if (input != null && input != "")
  13.                     {
  14.                         int num = int.Parse(input);
  15.                         Console.WriteLine(num);
  16.                     }                      
  17.             }
  18.            
  19.             catch
  20.             {
  21.                
  22.             }
  23.             Console.WriteLine("Error!");   
  24.         }      
  25.     }
  26.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement