SHARE
TWEET

Untitled

a guest Jan 16th, 2014 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Ex06TwentyChars
  5. {
  6.     class TwentyChars
  7.     {
  8.         static void Main()
  9.         {
  10.             try
  11.             {
  12.                 string input = Console.ReadLine();
  13.                 if(input.Length>20) throw new ArgumentOutOfRangeException();
  14.                 if(input.Length<20)
  15.                 input = input.Insert(input.Length, new string('*', 20 - input.Length));
  16.                 Console.WriteLine(input);
  17.             }
  18.             catch (ArgumentOutOfRangeException)
  19.             {
  20.                 Console.WriteLine("Error: String cannot exceed 20 symbols");
  21.             }
  22.         }
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top