fork download
  1. #include <iostream>
  2. using namespace std;
  3. int x;
  4. int contapos=0;
  5. int contaneg=0;
  6. int main() {
  7.  
  8. for (int i=1; i<=10; i++)
  9. {
  10. cin>>x;
  11. if (x>0) {contapos++;}
  12. else {contaneg++;}
  13. }
  14.  
  15. cout<<" i numeri positivi sono "<<contapos<<endl;
  16. cout<<" i numeri negativi sono "<<contaneg<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5328KB
stdin
-5 6 -7 8 -1 12 13 -12 -3 -5
stdout
 i numeri positivi sono 4
 i numeri negativi sono 6