Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homeWorkMultiplesNumbers
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int minValueNumber = 10;
- int maxValueNumber = 25;
- int minValueRange = 50;
- int maxValueRange = 150;
- int number = random.Next(minValueNumber, maxValueNumber+1);
- int countNumber = 0;
- int sumMultiplesNumber = 0;
- Console.Write(
- $"Сгенерированное число: {number}\n" +
- $"Количество кратных ему в диапозоне от {minValueRange} до {maxValueRange} равно: ");
- for (int i = 0; i <= maxValueRange; i++ )
- {
- sumMultiplesNumber += number;
- if (sumMultiplesNumber >= minValueRange && sumMultiplesNumber <= maxValueRange)
- {
- countNumber++;
- }
- }
- Console.WriteLine(countNumber);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement