Soru
Algorithm to find the sum and average of a given series of numbers Algorithm Step-1 Start Step-2 COUNT=0 Step-3 SUM=0 Step-4 Input NUM (next number in series) Step-5 SUM=SUM+NUM Step-6 COUNT=COUNT+1 Step-7 IF More Number in Series then GOTO Step-4 ENDIF Step-8 AVERGAE=SUM/ COUNT Step-9 WRITE SUM, AVERAGE Step-10 Stop True False
Çözüm
3.7179 Voting
Okay
Usta · 5 yıl öğretmeniUzman doğrulaması
Cevap
The algorithm provided is correct. It takes a series of numbers as input and calculates the sum and average of the numbers. The algorithm starts by initializing two variables, SUM and COUNT, to 0. Then, it takes the next number in the series as input and adds it to the SUM variable. It also increments the COUNT variable by 1. This process is repeated until all numbers in the series have been processed. Finally, the average is calculated by dividing the SUM by the COUNT, and both the SUM and AVERAGE are written out.
Derecelendirmek için tıklayın: