Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework15
- {
- class Program
- {
- static void Main()
- {
- Random random = new Random();
- int minimumRandomNumber = 1;
- int maximumRandomNumber = 28;
- int numberN = random.Next(minimumRandomNumber, maximumRandomNumber);
- int minimumStartNumber = 0;
- int minimumThreeDigitNumber = 100;
- int maximumThreeDigitNumber = 999;
- int numberOfMultiples = 0;
- Console.WriteLine($"Число из указанного диапазона: {numberN}.\n");
- for (int i = minimumStartNumber; i <= maximumThreeDigitNumber; i += numberN)
- {
- if (i >= minimumThreeDigitNumber)
- {
- Console.WriteLine($"Кратное число: {i}");
- numberOfMultiples++;
- }
- }
- Console.WriteLine($"\nКоличество трехзначных натуральных чисел, которые кратны N: {numberOfMultiples}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement