fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int even = 0, odd = 0, positive = 0, negative = 0;
  7. for (int i = 0; i < 5; ++i) {
  8. int a;
  9. cin >> a;
  10. if (a % 2 == 0) {
  11. even++;
  12. } else {
  13. odd++;
  14. }
  15. if (a > 0) {
  16. positive++;
  17. }
  18. if (a < 0) {
  19. negative++;
  20. }
  21. }
  22. cout << even << " valor(es) par(es)\n";
  23. cout << odd << " valor(es) impar(es)\n";
  24. cout << positive << " valor(es) positivo(s)\n";
  25. cout << negative << " valor(es) negativo(s)\n";
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 15240KB
stdin
-5
0
-3
-4
12
stdout
3 valor(es) par(es)
2 valor(es) impar(es)
1 valor(es) positivo(s)
3 valor(es) negativo(s)