Tính tổng các chữ số

View as PDF



Time limit:
Scratch 5.75s
Memory limit:
Scratch 977M

Authors:
Problem types
Points: 800 Time limit: 1.0s Memory limit: 256M Input: stdin Output: stdout

Cho một số nguyên dương \(n\), hãy tính tổng các chữ số của số nguyên đã cho.

Input

  • Dòng thứ nhất chứa số \(t(1\leq t\leq 10^5)\) - Thể hiện số testcase
  • \(t\) dòng tiếp theo, mỗi dòng chứa số nguyên \(n(1\leq n\leq 10^9)\)

Output

  • Ứng với mỗi testcase, in ra đáp án cần tìm

Example

Test 1

Input
2
15
24
Output
6
6

Comments (23)

Most recent
Loading comments...