Created
February 26, 2018 21:38
-
-
Save sguzunov/08f19e6ec29e06f587a9170341153b18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace BarcodeGenerator | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string firstNumberAsString = Console.ReadLine(); // "3333" | |
string secondNumberAsString = Console.ReadLine(); // "3339" | |
int firstStart = (int)Char.GetNumericValue(firstNumberAsString[0]); // -> char '3' -> 3 | |
int firstEnd = (int)Char.GetNumericValue(secondNumberAsString[0]); | |
int secondStart = (int)Char.GetNumericValue(firstNumberAsString[1]); | |
int secondEnd = (int)Char.GetNumericValue(secondNumberAsString[1]); | |
int thirdStart = (int)Char.GetNumericValue(firstNumberAsString[2]); | |
int thirdEnd = (int)Char.GetNumericValue(secondNumberAsString[2]); | |
int fourthStart = (int)Char.GetNumericValue(firstNumberAsString[3]); | |
int fourthEnd = (int)Char.GetNumericValue(secondNumberAsString[3]); | |
// 2323 | |
firstStart = firstStart % 2 == 0 ? firstStart + 1 : firstStart; | |
secondStart = secondStart % 2 == 0 ? secondStart + 1 : secondStart; | |
thirdStart = thirdStart % 2 == 0 ? thirdStart + 1 : thirdStart; | |
fourthStart = fourthStart % 2 == 0 ? fourthStart + 1 : fourthStart; | |
for (int firstDigit = firstStart; firstDigit <= firstEnd; firstDigit += 2) | |
{ | |
for (int secondDigit = secondStart; secondDigit <= secondEnd; secondDigit += 2) | |
{ | |
for (int thirdDigit = thirdStart; thirdDigit <= thirdEnd; thirdDigit += 2) | |
{ | |
for (int fourthDigit = fourthStart; fourthDigit <= fourthEnd; fourthDigit += 2) | |
{ | |
Console.Write("{0}{1}{2}{3} ", firstDigit, secondDigit, thirdDigit, fourthDigit); | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment