Question: Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the

Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average (using integer division) and max. A negative integer ends the input and is not included in the statistics.

Ex: When the input is:

15 20 0 5 -1 

the output is:

10 20 

Assume that at least one non-negative integer is input.

Write this in Coral Language - help with my code below

integer num integer avg integer max integer count integer sum

sum = 0 num = Get next input max = num while num >= 0 if num > max max = num sum = sum + num count = count + 1 num = Get next input avg = sum / count Put avg to output Put " " to output Put max to output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock