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


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

i:integer;
s:real;
begin
for i:=1 to 100 do s:=s+i*i;
s:=s/100;
writeln('Среднее квадратов первых 100 чисел: ',s)
end.



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.


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







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili