69 759
Assignments Done
Successfully Done
In February 2019

Answer to Question #57079 in C++ for yaseen

Question #57079
) 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.
Expert's answer
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 ’

Input a
if a≠9999 then
Let n=n+1
Les sum=sum+a
end if
until a≠9999

if n≠0 then
Print ‘Average is ’, avg
Print ‘Sequence is empty’
End if

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions