Вопрос задан 05.05.2019 в 07:36. Предмет Информатика. Спрашивает Тилинька Орест.

СРОЧНО ПОЖАЛУЙСТА ,НУЖНО НАПИСАТЬ ПРОГРАММУ. 1.Дан массив чисел ,найти сумму элементов больше 10 и

меньше 20
0 0
Перейти к ответам

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

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

var a:array[1..N] of integer;

s,K:integer;

begin

readln(K);

for i:=1 to N do readln(a[i]);

for i:=1 to N do

if (a[i] mod K=0) then s:=s+a[i];

write(s);

end. 

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

Program to Find Sum of Elements Greater Than 10 and Less Than 20 in an Array

To solve this problem, you can use the following Python program:

```python # Given array of numbers arr = [5, 12, 8, 15, 18, 20, 10]

# Initialize sum total_sum = 0

# Iterate through the array for num in arr: if 10 < num < 20: total_sum += num

# Print the sum print("The sum of elements greater than 10 and less than 20 is:", total_sum) ```

This program initializes an array of numbers, iterates through the array, and adds the numbers that are greater than 10 and less than 20 to the total sum. Finally, it prints the total sum.

Note: This program assumes that the array of numbers is predefined. If you want to take input from the user, you can modify the program to include input statements for array elements.

I hope this helps! If you have any further questions or need additional assistance, feel free to ask.

0 0

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

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

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