Skip to content

Instantly share code, notes, and snippets.

@Attosius
Created August 31, 2025 16:18
Show Gist options
  • Save Attosius/9dd9eafb67d77e73918bda6b3efac012 to your computer and use it in GitHub Desktop.
Save Attosius/9dd9eafb67d77e73918bda6b3efac012 to your computer and use it in GitHub Desktop.
ДЗ: Кратные числа
using System;
namespace IJuniorTasks
{
internal class Program
{
static void Main(string[] args)
{
var nFrom = 10;
var nTo = 25;
var random = new Random();
var n = random.Next(nFrom, nTo + 1);
var fromNumber = 50;
var toNumber = 150;
var count = 0;
for (int i = 0; i < toNumber + 1; i += n)
{
if (i >= fromNumber)
{
count++;
}
}
Console.WriteLine($"Количество чисел между {fromNumber} и {toNumber} кратных {n}: {count}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment