Вопрос задан 16.02.2019 в 06:05. Предмет Информатика. Спрашивает Котик Вероника.

С клавиатуры вводится 10 чисел найти среднее арифметическое этих чисел. Паскаль

0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Barbq-Junior Андрюха.
Var a:array[1..10] of integer;
i,k:integer;
s:real;
begin
k:=0;
writeln('Введите числа');
for i:=1 to 10 do
begin
readln(a[i]);
k:=k+a[i];
end;
s:=k/10;
writeln('Среднее арифметическое равняется ',s);
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding the Average of 10 Numbers in Pascal

To find the average of 10 numbers in Pascal, you can use the following steps:

1. Input 10 Numbers: First, input the 10 numbers from the keyboard. 2. Calculate the Average: Then, calculate the average of these numbers by adding them together and dividing by the total count of numbers.

Here's a simple Pascal program to achieve this:

```pascal Program Srednee; Uses Crt; Var First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth: Integer; Average: Real; Begin Write('Enter the first number: '); Readln(First); Write('Enter the second number: '); Readln(Second); Write('Enter the third number: '); Readln(Third); Write('Enter the fourth number: '); Readln(Fourth); Write('Enter the fifth number: '); Readln(Fifth); Write('Enter the sixth number: '); Readln(Sixth); Write('Enter the seventh number: '); Readln(Seventh); Write('Enter the eighth number: '); Readln(Eighth); Write('Enter the ninth number: '); Readln(Ninth); Write('Enter the tenth number: '); Readln(Tenth);

Average := (First + Second + Third + Fourth + Fifth + Sixth + Seventh + Eighth + Ninth + Tenth) / 10; Writeln('The average of the 10 numbers is: ', Average:0:2); End. ```

This program prompts the user to input 10 numbers and then calculates their average.

Note: The program uses the `Readln` function to read input from the keyboard and the `Writeln` function to display the average.

This program follows the basic steps of inputting the numbers and calculating their average, as per the user's request.

- Source:

0 0

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

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

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