Вопрос задан 22.02.2019 в 20:38. Предмет Информатика. Спрашивает Ашряпов Даня.

КуМир.Заполните массив из 20 чисел с помощью генератора случайных чисел от 1 до 20 и найдите

среднее значение элементов массива.
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Бобарико Кирилл.
алг
нач цел б,ср=0, цел таб а[1:20]
нц
для б от 1 до 20
а[б]:=int(rnd(20))
ср:=ср+а[б]
кц
вывод (ср/20)
кон
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Generating an Array of 20 Random Numbers and Finding the Mean

To generate an array of 20 random numbers between 1 and 20 and find the mean value of the elements, you can use a programming language like Python. Here's a simple example of how you can achieve this:

```python import random

# Generate an array of 20 random numbers between 1 and 20 random_numbers = [random.randint(1, 20) for _ in range(20)]

# Calculate the mean value of the elements in the array mean_value = sum(random_numbers) / len(random_numbers)

print(random_numbers) print(mean_value) ```

In this example, we use the `random` module in Python to generate 20 random numbers between 1 and 20 and store them in the list `random_numbers`. Then, we calculate the mean value by summing up all the numbers in the list and dividing by the total count of numbers.

The mean value of the elements in the array will be printed as the output.

Please note that this is just one way to achieve this task, and there are many other programming languages and methods to accomplish the same goal.

0 0

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

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

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