Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Last active May 16, 2023 16:08
Show Gist options
  • Save Strelok78/a9086dfb54a1a16c006d31096e8ae980 to your computer and use it in GitHub Desktop.
Save Strelok78/a9086dfb54a1a16c006d31096e8ae980 to your computer and use it in GitHub Desktop.
N (1 ≤ N ≤ 27). Finds the number of three-digit natural numbers that are multiples of N. Division operations (/, %) are not used. And multiplication is not required. The number N is only one.
namespace MyCode
{
internal class Program
{
static void Main(string[] args)
{
int minRandom = 1;
int maxRandom = 100;
int randomNumber = new Random().Next(minRandom, maxRandom+1);
int minValue = 100;
int maxValue = 1000;
int counter = 0;
for (int i = minValue; i < maxValue; i += randomNumber)
{
counter++;
}
Console.WriteLine($"The number of three-digit natural numbers that are multiples of {randomNumber} is {counter}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment