Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Last active April 21, 2025 13:22
Show Gist options
  • Save Strelok78/c36c850e14f6b7bee6108dbb39ac07a1 to your computer and use it in GitHub Desktop.
Save Strelok78/c36c850e14f6b7bee6108dbb39ac07a1 to your computer and use it in GitHub Desktop.
get multiple numbers to a random value in between values (without "*", "/" or "%")
using System.Diagnostics;
namespace iJuniorPractice;
class Program
{
static void Main(string[] args)
{
int multipleMinValue = 10;
int multipleMaxValue = 25;
int rangeMin = 50;
int rangeMax = 150;
Random random = new Random();
int multipleValue = random.Next(multipleMinValue, multipleMaxValue + 1);
int multipleValuesCount = 0;
Console.WriteLine("Multiple value = {0}", multipleValue);
for (int i = multipleValue; i <= rangeMax; i += multipleValue)
{
if (i >= rangeMin)
multipleValuesCount++;
}
Console.WriteLine(multipleValuesCount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment