Skip to content

Commit e51a3f0

Browse files
committed
update
1 parent c14137a commit e51a3f0

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Algorithms/Other/Luhn.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,22 @@ namespace Algorithms.Other;
1010
/// </summary>
1111
public static class Luhn
1212
{
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>
1421
public static bool Validate(string number) => GetSum(number) % 10 == 0;
1522

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>
1729
public static int GetLostNum(string number)
1830
{
1931
var missingDigitIndex = number.Length - 1 - number.LastIndexOf('x');
@@ -26,7 +38,11 @@ public static int GetLostNum(string number)
2638
: (checkDigit + 9) / 2;
2739
}
2840

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>
3046
private static int GetSum(string number)
3147
{
3248
var sum = 0;

0 commit comments

Comments
 (0)