File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,22 @@ namespace Algorithms.Other;
10
10
/// </summary>
11
11
public static class Luhn
12
12
{
13
- // Checking the validity of a sequence of numbers.
13
+ /// <summary>
14
+ /// Checking the validity of a sequence of numbers.
15
+ /// </summary>
16
+ /// <param name="number">The number that will be checked for validity.</param>
17
+ /// <returns>
18
+ /// True: Number is valid.
19
+ /// False: Number isn`t valid.
20
+ /// </returns>
14
21
public static bool Validate ( string number ) => GetSum ( number ) % 10 == 0 ;
15
22
16
- // Finds one missing digit. In place of the unknown digit, put "x".
23
+ /// <summary>
24
+ /// This algorithm finds one missing digit.
25
+ /// In place of the unknown digit, put "x".
26
+ /// </summary>
27
+ /// <param name="number">The number in which to find the missing digit.</param>
28
+ /// <returns>Missing digit.</returns>
17
29
public static int GetLostNum ( string number )
18
30
{
19
31
var missingDigitIndex = number . Length - 1 - number . LastIndexOf ( 'x' ) ;
@@ -26,7 +38,11 @@ public static int GetLostNum(string number)
26
38
: ( checkDigit + 9 ) / 2 ;
27
39
}
28
40
29
- // Computes the sum found by the Luhn algorithm, optimized with Span.
41
+ /// <summary>
42
+ /// Computes the sum found by the Luhn algorithm.
43
+ /// </summary>
44
+ /// <param name="number">The number for which the sum will be calculated.</param>
45
+ /// <returns>Sum.</returns>
30
46
private static int GetSum ( string number )
31
47
{
32
48
var sum = 0 ;
You can’t perform that action at this time.
0 commit comments