var
n, a, i, k, l, m: integer;
begin
k := 0;
l := 0;
m := 0;
read(n);
for i := 1 to n do
read(a);
if (a = 0) then
k := k + 1;
if (a > 0) then
l := l + 1;
if (a < 0) then
m := m + 1;
end;
writeln(k, ' ', l, ' ', m, ' ');
end.
Объяснение:
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int mass[];
for (int i = 0; i < n; i++) {
cin >> mass[i];
}
int count_0 = 0, count_pol = 0, count_otr = 0;
if (mass[i] == 0) {
count_0++;
if (mass[i] > 0) {
count_pol++;
if (mass[i] < 0) {
count_otr++;
cout << count_0 << " " << count_pol << " " <<count_otr;
cout <<endl;
system ("pause");
return 0;
var
n, a, i, k, l, m: integer;
begin
k := 0;
l := 0;
m := 0;
read(n);
for i := 1 to n do
begin
read(a);
if (a = 0) then
k := k + 1;
if (a > 0) then
l := l + 1;
if (a < 0) then
m := m + 1;
end;
writeln(k, ' ', l, ' ', m, ' ');
end.
Объяснение:
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int mass[];
for (int i = 0; i < n; i++) {
cin >> mass[i];
}
int count_0 = 0, count_pol = 0, count_otr = 0;
for (int i = 0; i < n; i++) {
if (mass[i] == 0) {
count_0++;
}
if (mass[i] > 0) {
count_pol++;
}
if (mass[i] < 0) {
count_otr++;
}
}
cout << count_0 << " " << count_pol << " " <<count_otr;
cout <<endl;
system ("pause");
return 0;
}