-Annie-

StringLength

Jun 8th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. namespace StringLength
  2. {
  3.     using System;
  4.  
  5.     public class StringLength
  6.     {
  7.         public static void Main()
  8.         {
  9.             string input = Console.ReadLine();
  10.  
  11.             if (input.Length < 20)
  12.             {
  13.                 Console.WriteLine(input + new string('*', 20-input.Length));
  14.             }
  15.  
  16.             else if (input.Length == 20)
  17.             {
  18.                 Console.WriteLine(input);
  19.             }
  20.  
  21.             else if (input.Length > 20)
  22.             {
  23.                 string newString = input.Substring(0, 20);
  24.                 Console.WriteLine(newString);
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment