Last active
April 21, 2025 13:22
-
-
Save Strelok78/c36c850e14f6b7bee6108dbb39ac07a1 to your computer and use it in GitHub Desktop.
get multiple numbers to a random value in between values (without "*", "/" or "%")
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.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