Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BarcodeGenerator
- {
- class Program
- {
- public static void Main()
- {
- int startNum = int.Parse(Console.ReadLine());
- int finalNum = int.Parse(Console.ReadLine());
- for (int a = (int)(startNum / 1000); a <= (int)(finalNum / 1000); a++)
- {
- for (int b = (int)(startNum / 100) % 10; b <= (int)(finalNum / 100) % 10; b++)
- {
- for (int c = (int)(startNum / 10) % 10; c <= (int)(finalNum / 10) % 10; c++)
- {
- for (int d = startNum % 10; d <= finalNum % 10; d++)
- {
- if (a % 2 == 1 && b % 2 == 1 && c % 2 == 1 && d % 2 == 1)
- {
- Console.Write($"{a}{b}{c}{d} ");
- }
- }
- }
- }
- }
- }
- }
- }
- ИЛИ:
- using System;
- namespace BarcodeGenerator
- {
- class Program
- {
- public static void Main()
- {
- string startNum = Console.ReadLine();
- string finalNum = Console.ReadLine();
- for (int a = startNum[0]; a <= finalNum[0]; a++)
- {
- for (int b = startNum[1]; b <= finalNum[1]; b++)
- {
- for (int c = startNum[2]; c <= finalNum[2]; c++)
- {
- for (int d = startNum[3]; d <= finalNum[3]; d++)
- {
- if ((char)a % 2 == 1 && (char)b % 2 == 1 && (char)c % 2 == 1 && (char)d % 2 == 1)
- {
- Console.Write($"{(char)a}{(char)b}{(char)c}{(char)d} ");
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement