I've done most of my programming in C, C++ and 8080, 8086, 286, Pentium, etc., assembler. Worked several years as a consultant to Microsoft on Win95.
For those who can read VBA, here's the program (a bit of a kludge, but the idea should be clear). Output is stored in the "dataY" worksheet:
Dim cards (10)
Worksheets("dataY").Cells(34, 1).Value = CDbl(52 * 51) * 50 ' Denominator
For Sum = 3 To 30 ' all possible sums
ways = 0
For i = 1 To 10 ' init cards array to number
If i = 10 Then cards(i) = 16 Else cards(i) = 4
Next
For c1 = 1 To 10
If c1 > 1 Then cards(c1 - 1) = cards(c1 - 1) + 1 ' add back the last card
cards(10) = 16 ' reinit
If c1 > Sum Then Exit For
way1 = cards(c1)
cards(c1) = cards(c1) - 1
For c2 = 1 To 10 ' compute for all possible 2nd cards
If c2 > 1 Then cards(c2 - 1) = cards(c2 - 1) + 1 ' add back the last card
If c1 + c2 > Sum Then Exit For
way2 = cards(c2)
cards(c2) = cards(c2) - 1 ' prepare in case we use the card below
For c3 = 1 To 10 ' all 3rd cards
If c3 + c2 + c1 > Sum Then Exit For
If c3 + c2 + c1 = Sum Then
way3 = cards(c3)
wayp = way1 * way2 * way3
ways = ways + wayp
Exit For
End If
Next
Next
Next
Worksheets("dataY").Cells(Sum, 1).Value = ways
Next