Вопрос задан 08.05.2019 в 09:10. Предмет Информатика. Спрашивает Кремешков-Зозуля Дмитрий.

Найти среднее арифметическое квадратов всех целых чисел от 1 до 100.программа в паскале

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

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Ким Рамина.
Var
   i:integer;
   s:real;
begin
for i:=1 to 100 do s:=s+i*i;
s:=s/100;
writeln('Среднее квадратов первых 100 чисел: ',s)
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding the Average of Squares of Integers from 1 to 100 in Pascal

To find the average of the squares of all integers from 1 to 100 in Pascal, you can use a loop to calculate the sum of the squares and then divide it by the total number of integers.

Here's a Pascal program that accomplishes this:

```pascal program AverageOfSquares;

var sumOfSquares, i: integer; average: real;

begin sumOfSquares := 0;

for i := 1 to 100 do begin sumOfSquares := sumOfSquares + i * i; end;

average := sumOfSquares / 100;

writeln('The average of the squares of integers from 1 to 100 is: ', average:0:2); end. ```

This program initializes a variable `sumOfSquares` to 0. Then, using a `for` loop, it iterates from 1 to 100 and adds the square of each integer to the `sumOfSquares` variable. After the loop, it calculates the average by dividing the `sumOfSquares` by the total number of integers (which is 100 in this case). Finally, it displays the result using the `writeln` function.

When you run this program, it will output the average of the squares of integers from 1 to 100.

Note: The program assumes you have a Pascal compiler installed and configured on your system.

0 0

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

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

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