Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int minimalNumber = 100;
- int maximalNumber = 999;
- int dividerMinimalNumber = 1;
- int dividerMaximalNumber = 27;
- int countNumbers = 0;
- int dividerNumber;
- Random rand = new Random();
- dividerNumber = rand.Next(dividerMinimalNumber, dividerMaximalNumber + 1);
- Console.WriteLine($"Случайное число от {dividerMinimalNumber} до {dividerMaximalNumber}: {dividerNumber}.");
- Console.WriteLine($"Натуральне числа от {minimalNumber} включительно до {maximalNumber} включительно и кратные {dividerNumber}:");
- for (int i = dividerNumber; i <= maximalNumber; i+= dividerNumber)
- {
- if (i >= minimalNumber)
- {
- Console.Write($"{i} ");
- countNumbers ++;
- }
- }
- Console.WriteLine();
- Console.WriteLine($"Количество Натуральных чисел от {minimalNumber} включительно до {maximalNumber} включительно и кратных {dividerNumber}: {countNumbers}");
- Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement