Вопрос задан 31.07.2023 в 23:04. Предмет Информатика. Спрашивает Гаджега Вікторіка.

Дан целочисленный массив из 30 элементов, которые могут принимать значения от 0 до 100 – баллы

учащихся за итоговый тест по информатике. Напишите программу, которая подсчитывает и выводит на экран средний балл класса, и также разность между ним и максимальным значением. Нужна полная программа на языке Паскаль АВС.
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Ковтун Полина.
Var max,sum,sred,razn:real;i:integer;mas:array[1..30] of integer;beginRandomize;max:=mas[1];for i:=1 to 30 dobeginmas[i]:=random(1,100);end;writeln('оценки класса');for i:=1 to 30 dobeginwrite(mas[i],' ');if(mas[i]>max) then max:=mas[i];sum:=sum+mas[i];end;sred:=sum/30;razn:=sred-max;writeln();writeln('среднее = ',sred);writeln('сумма оценок= ',sum);writeln('разность ',razn);end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Sure, here's a complete Pascal ABC program that calculates the average score of the class and the difference between the average and the maximum score:

pascal
program CalculateAverageAndDifference; const N = 30; // Number of students var scores: array[1..N] of integer; i: integer; sum, maxScore: integer; average, difference: real; begin // Input scores writeln('Enter the scores of 30 students:'); for i := 1 to N do begin write('Student ', i, ': '); readln(scores[i]); end; // Calculate sum and maximum score sum := 0; maxScore := scores[1]; for i := 1 to N do begin sum := sum + scores[i]; if scores[i] > maxScore then maxScore := scores[i]; end; // Calculate average and difference average := sum / N; difference := maxScore - average; // Output results writeln('Average score of the class: ', average:0:2); writeln('Difference between maximum score and average: ', difference:0:2); end.

In this program, we use the scores array to store the 30 student scores. We then loop through the array to calculate the sum of scores and find the maximum score. Afterward, we calculate the average score and the difference between the maximum score and the average. Finally, the program displays the average score and the difference on the screen.

0 0

Похожие вопросы

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос