numeros
Publicado por kelly (17 intervenciones) el 26/10/2022 05:32:20
Lea X números, informe cuántos fueron positivos y cuántos fueron
negativos.
negativos.
Valora esta pregunta


0
#include <iostream>
using namespace std;
int main()
{
int sz, n, pos = 0, neg = 0;
cout << "Cuantos numeros: "; cin >> sz;
for (int i = 0; i < sz; i++)
{
cout << "Numero " << i + 1 << ": ";
cin >> n;
if (n > 0) pos++;
else neg++;
}
cout << endl;
cout << "Positivos: " << pos << endl;
cout << "Negativos: " << neg << endl;
return 0;
}