Question

Write an algorithm for a program that accepts a set of numbers
and finds the smallest among them and computes the sum of
the numbers accepted. The program stops when the user
enters number 999. Convert the algorithm into flowchart

Answers

Steve
as the numbers are accepted, keep track of the smallest. That way there is no need to do a sort later on.

read least
sum=least
val=least
WHILE val ne 999 DO
  read val
  sum += val
  least = val if val < least
DONE
print least,sum

Of course, an array must be used if the list of numbers needs to be retained for some reason.
Steve
rats. The above loop will include the terminating 999 in the sum. It is a simple change to stop before including it.
bam
please answer this
allan
an algorithm in pseudo-code that accept 10 students marks and output average mark
tesfit
Design an algorithm that keeps reading positive numbers until the user enters a zero value, and determines and outputs the largest number

Related Questions