SHARE
TWEET

Asterixes

Krissy Jan 26th, 2013 214 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Text;
  3.  
  4. class Asterixes
  5. {
  6.     static void Main()
  7.     {
  8.         Console.Write("Please enter string with no more than 20 characters!");
  9.         string text = Console.ReadLine();
  10.  
  11.         if (text.Length > 20)
  12.         {
  13.             Console.WriteLine("No more than 20 characters, please!");
  14.         }
  15.         else
  16.         {
  17.             StringBuilder twentyChars = new StringBuilder();
  18.             twentyChars.Append(text);
  19.             while (twentyChars.Length < 20)
  20.             {
  21.                 twentyChars.Append('*');
  22.             }
  23.             Console.WriteLine("The changed text is:{0}",twentyChars.ToString());
  24.         }
  25.     }
  26. }
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