Advertisement
Krissy

Asterixes

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