Advertisement
askarulytarlan

Задача №346. Подсчет чисел

Oct 24th, 2016
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <math.h>
  5.  
  6.  
  7. using namespace std;
  8.  
  9. int a, b, c, d, e;
  10. int main(int argc, const char * argv[]) {
  11. a = 0;
  12. b = 0;
  13. c = 0;
  14. cin >> d;
  15. for(int i = 1; i <= d; i++){
  16. cin >> e;
  17. if(e == 0){
  18. a = a + 1;
  19. }
  20. else if(e > 0){
  21. b = b + 1;
  22. }
  23. else if(e < 0) {
  24. c = c + 1;
  25. }
  26. }
  27. cout << a << " " << b << " " << c;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement