Advertisement
VasilKotsev

Characters in range

Feb 16th, 2019
2,284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. namespace CharactersInRange
  2. {
  3.     using System;
  4.  
  5.     public class EntryPoint
  6.     {
  7.         public static void Main()
  8.         {
  9.             char inputOne = char.Parse(Console.ReadLine());
  10.             char inputTwo = char.Parse(Console.ReadLine());
  11.  
  12.             PrintTheCharsBetweenTwoChars(inputOne, inputTwo);
  13.         }
  14.  
  15.         private static void PrintTheCharsBetweenTwoChars(char firstCharacter, char secondCharacter)
  16.         {
  17.             int startCharacter = Math.Min(firstCharacter, secondCharacter);
  18.             int endCharacter = Math.Max(firstCharacter, secondCharacter);        
  19.  
  20.             for (int i = ++startCharacter; i < endCharacter; i++)
  21.             {
  22.                 Console.Write((char)i + " ");
  23.             }
  24.  
  25.             Console.WriteLine();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement