Sum of Multiples of 2 and 3


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

題目說明

使用者輸入一系列整數,程式持續把所有2和3的倍數挑出來加總,若程式遇到0,立刻停止加總並輸出先前加總的數字。

輸入規範

一系列整數,數字範圍是0到100

輸出規範

一個整數

範例輸入 #1

1 2 3 4 5 6 7 8 9 10 11 0 2 3 2 3 2 3

範例輸出 #1

42

說明:2+3+4+6+8+9+10=42

範例輸入 #2

5 7 11 13 17 19 4 9 0 8 6

範例輸出 #2

13

說明:4+9=13


Comments

There are no comments at the moment.