Last active
May 16, 2023 16:08
-
-
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.
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
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