Professional Documents
Culture Documents
THUẬT TOÁN
http://InformationR.net/ir/9-4/paper191.html
1 2 3 𝑛
S(n)= + + + ⋯ + (𝑛 > 0)
2 3 4 𝑛+1
❑Viết hàm tính tổng các chữ số có trong số nguyên
dương
Ví dụ: n=23415 ➔ 2+3+4+1+5=15
𝑆 𝑛 = 2 + 2 + 2 + 2 (𝑛 𝑑ấ𝑢 𝑐ă𝑛)