Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int min = 0;
- int max = 100;
- Random random = new Random();
- int number = random.Next(min, max);
- Console.WriteLine($"Случайное число от 0 до 100 - {number}");
- int sum = 0;
- for (int i = 0; i < number; i++)
- {
- int multipleOfTree = 3;
- int multipleOfFive = 5;
- if ((i % multipleOfTree) == 0 || (i % multipleOfFive) == 0)
- sum += i;
- }
- Console.WriteLine($"Сумма чисел кратных 3 и 5 - {sum}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement