Created
August 31, 2025 16:18
-
-
Save Attosius/9dd9eafb67d77e73918bda6b3efac012 to your computer and use it in GitHub Desktop.
ДЗ: Кратные числа
This file contains hidden or 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; | |
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