HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


033. 50588 - Processing the list of numbers

Guest
• Review clarifications (2)

Volume problems

• 023. 50437 - Age Labeling
• 024. 50372 - Number Quadruplets
• 025- 2013-Nov-01. 50328 - How far ...
• 026. 50399 - Mobile Base Station
• 026. 50487 - Radius of Inscribed Circle
• 027. 50548 - Albanian Airlines
• 028. 50483 - Group Total
• 030. 50584 - Total invoice amount
• 033. 50588 - Processing the list...
• 035. 50573 - Count and Sum
• 040. 50335 - Five Math Operators
• 044. 50597 - Drawing Diamonds
• 045. 50462 - Class Average (3 Gra...
• 050. 50450 - Last Appereance of a ...
• 058. 50574 - Triangular Numbers
• 060. 50362 - Pythagorean Numbers
• 060. Problem 2

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Processing the list of numbers

Shqip

In a file there is a list of positive numbers ending with a negative number (-1).

Your program should count the numbers and output the sum and their average (integer). In the list contains maximally 10000 integer numbers, with maximally 8 digits. Number -1 determines the end of the list. (use while loop)

Input
You will be given a list of n positive numbers ending with a negative one (-1), where 0 ≤ n ≤ 10000 and each of the n numbers has maximally 8 digits.

Output
The output will be three numbers in a line: cnt, sum, ave, respectively showing:
   cnt - number of numbers in the list;
   sum - the sum of the numbers in the list;
   ave - the average of the given numbers.


Input Output
5 7 3 4 8 -1
5 27 5

Для отправки решений необходимо выполнить вход.

www.contester.ru