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

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

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.



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.



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.


Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili