Construct a solution algorithm for the following programming
problems. Your solution should contain:
A defining diagram
A psuedocode algorithm
A desk check of the algorithm
Design an algorithm that will read a series of integers at the terminal. The first integer is special, as it indicates how many more integers will follow. Your algorithm is to calculate the sum and average of the integers, excluding the first integer, and display these values to the screen.
***Please do it in psuedocode thank you!
#defining diagram:
#psuedocode
first take the special integer from user store into n varibal
initialize sum=0 and i=0
iterate the loop until i<given special number
add each element to sum variable and add previous sum value
later increment i value
if i=n the loop terminates and print the sum
and print avg=sum/i
#soruce code in python:
n=int(input("Enter number"))
sum=0
i=0
while(i<n):
k=int(input(""))
sum=sum+k
i=i+1
print("Sum:",sum)
print("Average:",sum/i)
#output:
#if you have any doubts comment below.. if you like give thumbs up...
Get Answers For Free
Most questions answered within 1 hours.