Anasayfa
/
Teknoloji
/
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

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.7 (179 Oylar)
Okay
Uzman doğrulaması
Usta · 5 yıl öğretmeni

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.