Вопрос задан 01.08.2018 в 14:52. Предмет Информатика. Спрашивает Яцків Софія.

даны 10 произвольных действительных числа(вводятся с клавиатуры).Подсчитать количество

отрицательных чисел помогите составить программу
0 0
Перейти к ответам

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

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

var a,s,i:integer;
begin
s:=0;
for i:=1 to 10 do
 begin
 write('Число: '); readln(a);
 if a<0 then s:=s+1;
 end;
writeln('Кол-во отрицательных чисел: ',s);
end.

0 0
Отвечает Рыженко Андрей.

Program Zorkini;
uses crt;
const n=10;
var
  Z: real;
  i,k: integer;
begin
  k:=0;
  for i:=1 to n do
  begin  
    write('Введите ',i,'-e число ');
    readln(z);
    if z<0 then k:=k+1;
  end;
  writeln('Количество отрицательных чисел ',k);
end.

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

Program to Count Negative Numbers

To create a program that counts the number of negative numbers out of 10 arbitrary real numbers entered from the keyboard, you can use the following Python code:

```python # Initialize a counter for negative numbers negative_count = 0

# Input 10 arbitrary real numbers from the keyboard for _ in range(10): num = float(input("Enter a number: ")) if num < 0: negative_count += 1

# Print the count of negative numbers print("The number of negative numbers entered is:", negative_count) ```

This program initializes a counter for negative numbers, then prompts the user to input 10 arbitrary real numbers. For each input, it checks if the number is negative and increments the counter accordingly. Finally, it prints the count of negative numbers entered.

This program uses a simple loop and conditional check to achieve the desired functionality.

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

0 0

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

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

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