Advertisement
Guest User

Untitled

a guest
Jan 16th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement