calculate sum and average


Submit solution

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

Authors:
Problem type

題目說明

輸入一連串個數未定的整數,程式計算其總和及平均

當遇到0或小於0的數字,立即停止計算並輸出結果

平均以Math.round()取四捨五入

輸入資料限制:輸入數字都是整數,最小為-1000,最大為1000。至少輸入兩個數字且第一個數字為大於0的整數。

輸入

一連串整數

輸出

輸出均為int

總和及平均

sample input1

1 2 3 5 -1

sample output1

11 3

sample input2

1 2 3 0 1 2 3

sample output2

6 2

Comments

There are no comments at the moment.