Вопрос задан 07.07.2023 в 05:57. Предмет Информатика. Спрашивает Бирлик Айбике.

Создать одномерный массив А из 10 целых чисел (числа вводит пользователь), вывести на экран

массив в виде строки чисел. Сколько элементов массива кратных 3.
0 0
Перейти к ответам

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

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

Ответ:

PascalABC.NET:

  • begin
  •    var a := ReadArrInteger(10);
  •    a.Println;
  •    a.Count(c -> c mod 3 = 0).Print;
  • end.

Пример:


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

Sure! Here's a Python code that creates a one-dimensional array 'A' of 10 integers, with the numbers entered by the user. It then displays the array as a string of numbers and counts the number of elements in the array that are divisible by 3:

python
A = [] count = 0 # Input numbers from the user for i in range(10): num = int(input("Enter an integer number: ")) A.append(num) # Display the array as a string array_string = ' '.join(map(str, A)) print("Array: " + array_string) # Count the elements divisible by 3 for num in A: if num % 3 == 0: count += 1 print("Number of elements divisible by 3:", count)

In this code, the user will be prompted to enter 10 integer numbers. The numbers will be added to the array 'A', and then the array will be displayed as a string of numbers separated by spaces. Finally, the code counts the number of elements in the array that are divisible by 3 and prints the count.

0 0

Похожие вопросы

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

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

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