Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Ex06TwentyChars
- {
- class TwentyChars
- {
- static void Main()
- {
- try
- {
- string input = Console.ReadLine();
- if(input.Length>20) throw new ArgumentOutOfRangeException();
- if(input.Length<20)
- input = input.Insert(input.Length, new string('*', 20 - input.Length));
- Console.WriteLine(input);
- }
- catch (ArgumentOutOfRangeException)
- {
- Console.WriteLine("Error: String cannot exceed 20 symbols");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement