Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int numbers[25];
  8. int negatives = 0;
  9. int positives = 0;
  10. int zeros = 0;
  11. int sum = 0;
  12.  
  13. cout << "Введите 25 чисел" << endl;
  14.  
  15. for (int i = 0; i < 25; i++) {
  16. cout << i << ": Введите число" << endl;
  17. int numb;
  18. cin >> numb;
  19.  
  20. numbers[i] = numb;
  21.  
  22. if (numb < 0) negatives++;
  23. else if (numb > 0) positives++;
  24. else zeros++;
  25.  
  26. sum += abs(numb);
  27. }
  28.  
  29. count << "Позитивных: " << positives << ". Негативных: " << negatives << " . Нулей: " << zeros << endl;
  30. count << "Среднее арифметическое: " << sum / (positives + negatives);
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement