Вопрос задан 16.06.2023 в 21:06. Предмет Информатика. Спрашивает Passagir Victor.

ДАЮ 80 БАЛЛОВ ПРОШУ ПОМОГИТЕ Составить программу на языке Паскаль для решения следующей задачи:

Дан одномерный массив. В массиве хранятся оценки по информатике учеников 9 класса. Заполнить массив случайными числами, лежащими в диапазоне от 2 до 5 включительно. Вычислите среднюю оценку в классе по информатике. Входные данные для размерности массива задайте самостоятельно. На проверку нужно прислать текст кода программы, результат работы кода в виде скриншота окна программы с отображением кода и полученного результата. Программная реализация обязательна!
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Барышов Денис.

Ответ:

program z;

var o:array [1..19] of integer;

i,s:integer;

begin

randomize;

s:=0;

for i:=1 to 19 do

begin

o[i]:=random(4)+2;

write(o[i],' ');

s:=s+o[i]

end;

writeln;

write(s/19:5:3)

end.

Объяснение:

скрин


0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To solve the given task of calculating the average grade in the 9th-grade computer science class, you can write a Pascal program that generates random grades within the range of 2 to 5 (inclusive) and then calculates the average.

Here's an example Pascal program that accomplishes this task:

```pascal program AverageGrade;

const ARRAY_SIZE = 30; // Define the size of the array (you can change this value as needed)

var grades: array[1..ARRAY_SIZE] of Integer; // Declare the array to store the grades sum, average: Real; // Variables to store the sum and average

i: Integer; // Loop variable

begin Randomize; // Initialize the random number generator

// Fill the array with random grades for i := 1 to ARRAY_SIZE do grades[i] := Random(4) + 2; // Generate a random number between 2 and 5

// Calculate the sum of grades sum := 0; for i := 1 to ARRAY_SIZE do sum := sum + grades[i];

// Calculate the average grade average := sum / ARRAY_SIZE;

// Display the average grade writeln('Average grade in the class: ', average:0:2); end. ```

To run this program, you can use an IDE or compiler that supports Pascal, such as Free Pascal or Turbo Pascal. After running the program, it will display the average grade in the class.

Please note that the program uses a constant `ARRAY_SIZE` to define the size of the array. You can modify this value to match the desired number of grades in the class. Additionally, the program uses the `Randomize` procedure to initialize the random number generator, ensuring different random grades are generated each time the program is run.

Remember to provide the text of the code and a screenshot of the program's output, including the code and the calculated average grade, for submission.

I hope this helps! Let me know if you have any further questions.

0 0

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

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

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

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