Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3.  
  4. namespace _03._Characters_in_Range
  5. {
  6.     public class Program
  7.     {
  8.         public static void Main()
  9.         {
  10.             char firstCharacter = char.Parse(Console.ReadLine());
  11.             char secondCharacter = char.Parse(Console.ReadLine());
  12.             Console.WriteLine(Between(firstCharacter, secondCharacter));
  13.         }
  14.  
  15.         public static string Between(char firstCharacter, char secondCharacter)
  16.         {
  17.             string currentChar = string.Empty;
  18.             int one = (int) firstCharacter;
  19.             int second = (int) secondCharacter;
  20.             for (int i = one + 1; i < second; i++)
  21.             {
  22.                 firstCharacter = Convert.ToChar(i);
  23.                 currentChar += firstCharacter + " ";
  24.             }
  25.             return currentChar;
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement