Skip to content
本站總訪問量
本站訪客數 人次

TQC+ 程式語言Python 308 迴圈位數加總

題目說明: 請使用迴圈敘述撰寫一程式,要求使用者輸入一個數字,此數字代表後面測試資料的數量。每一筆測試資料是一個正整數(由使用者輸入),將此正整數的每位數全部加總起來。

範例輸入1

shell
1
98765

範例輸出1

shell
Sum of all digits of 98765 is 35

範例輸入2

shell
3
32412

範例輸出2

shell
Sum of all digits of 32412 is 12
Sum of all digits of 0 is 0
Sum of all digits of 769 is 22

Contributors

The avatar of contributor named as lucashsu95 lucashsu95

Changelog