-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson16.cs
More file actions
39 lines (33 loc) · 1.08 KB
/
Lesson16.cs
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
namespace Tired
{
class Program
{
static void Main(string[] args)
{
const int MinLoopBound = 100;
const int MaxLoopBound = 1000;
const int MinRandomBound = 0;
const int MaxRandomBound = 29;
int randomN = new Random().Next(MinRandomBound, MaxRandomBound);
int multipleOfRandomN = 0;
int SumOfMultiplesRandomN = 0;
Console.WriteLine("Случайное кратное число:" + randomN);
for (int i = MinLoopBound; i < MaxLoopBound; i++)
{
if (multipleOfRandomN < i)
{
multipleOfRandomN += randomN;
i--;
continue;
}
if(i == multipleOfRandomN)
{
SumOfMultiplesRandomN += i;
multipleOfRandomN += randomN;
}
}
Console.WriteLine("Сумма равна:" + SumOfMultiplesRandomN);
}
}
}