) Write a pseudocode that calculates and prints the average of
several integers. Assume the last value read with scanf is the sentinel 9999. A typical input sequence
might be
10 8 11 7 9 9999
indicating that the average of all the values preceding 9999 is to be calculated.
1
Expert's answer
2015-12-22T04:44:17-0500
Solution Declare a as integer Declare sum as real Declare avg as real Declare n as integer Let n=0 Let sum=0 Print ‘Input set of numbers, 9999 for end of sequence ’
repeat Input a if a≠9999 then Let n=n+1 Les sum=sum+a end if until a≠9999
if n≠0 then avg=sum/n Print ‘Average is ’, avg Else Print ‘Sequence is empty’ End if
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments