Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_Sharp_Junior
- {
- class Program
- {
- static void Main()
- {
- Random randomNumber = new Random();
- int sum = 0;
- int maxLimitValueRange = 101;
- int minDivisor = 3;
- int maxDivisor = 5;
- for (int i = 0; i <= randomNumber.Next(maxLimitValueRange); i++)
- {
- if (i % minDivisor == 0 || i % maxDivisor == 0)
- {
- sum += i;
- }
- }
- Console.WriteLine($"Сумму всех положительных чисел меньше {maxLimitValueRange - 1}, которые кратные {minDivisor} или {maxDivisor}: {sum}");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment