Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CaractersInRange
- {
- class Program
- {
- static void Main()
- {
- char start = char.Parse(Console.ReadLine());
- char end = char.Parse(Console.ReadLine());
- PrintsCharactersInRange(start, end);
- }
- public static void PrintsCharactersInRange(char start, char end)
- {
- string charactersInBetween = string.Empty;
- if((char)end > (char)start)
- {
- for (int i = start + 1; i < end; i++)
- {
- charactersInBetween += (char)i + " ";
- }
- }
- if ((char)end < (char)start)
- {
- for (int i = end + 1; i < start; i++)
- {
- charactersInBetween += (char)i + " ";
- }
- }
- Console.WriteLine(charactersInBetween);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment