fk4m1913

Untitled

Jun 16th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CharactersInRange
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             char firstChar = char.Parse(Console.ReadLine());
  10.             char secondChar = char.Parse(Console.ReadLine());
  11.             char temp;
  12.  
  13.             if (secondChar < firstChar)
  14.             {
  15.                 temp = firstChar;
  16.                 firstChar = secondChar;
  17.                 secondChar = temp;
  18.             }
  19.  
  20.             PrintCharactersInRange(firstChar, secondChar);
  21.         }
  22.  
  23.         static void PrintCharactersInRange(char firstChar, char secondChar)
  24.         {
  25.             for (int i = firstChar + 1; i < secondChar; i++)
  26.             {
  27.                 Console.Write((char)i + " ");
  28.             }
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment