Вопрос задан 01.03.2021 в 23:47. Предмет Информатика. Спрашивает Аслиев Амин.

заполнить массив размером 70 элементов случайными целыми числами из интервала (-80,70). вывести на

экран элементы,стоящие на местах кратных 7
0 0
Перейти к ответам

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

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

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

Sure! Here's an example code snippet in Python to fill an array of size 70 with random integers from the interval (-80, 70) and then print the elements at positions divisible by 7:

python
import random # Create an empty array array = [] # Fill the array with random integers from -80 to 70 for _ in range(70): number = random.randint(-80, 70) array.append(number) # Print the elements at positions divisible by 7 for i in range(0, len(array), 7): print(array[i])

This code uses the random.randint() function from the random module to generate random integers within the given range (-80, 70). It then appends each randomly generated number to the array list.

Afterward, it uses a loop to iterate over the array with a step size of 7 (range(0, len(array), 7)) to access the elements at positions divisible by 7. It prints each of these elements on a separate line.

Feel free to run this code in a Python environment to see the output. Let me know if you have any further questions!

0 0

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

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

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