using System using System Collections Generic namespace lab3 class Fin

 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
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
namespace lab3
{
class FindNum
{
private List<int> intList;
private List<int> digitList;
private int border;
public FindNum(int border)
{
intList = new List<int>();
digitList = new List<int>();
this.border = border;
}
private void SplitByDigits(int value)
{
while(value > 0)
{
digitList.Add(value % 10);
value /= 10;
}
}
public void Solution()
{
for(int value = 0; value <= border; value++)
{
SplitByDigits(value);
if (digitList.Contains(9))
intList.Add(value);
digitList.Clear();
}
}
public string GetNums()
{
string outStr = "";
foreach (int item in intList)
outStr += item + " ";
return outStr;
}
}
}