Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, b[50];
- cout << "Nhap n: "; cin >> n;
- for (int i = 0; i < n; i++) {
- cout << "Nhap b[" << i << "] = ";
- cin >> b[i];
- }
- int neg = 0, pos = 0;
- for (int i = 0; i < n; i++) {
- if (b[i] < 0) neg++;
- if (b[i] > 0) pos++;
- }
- cout << "So luong so am: " << neg << '\n';
- cout << "So luong so duong: " << pos << '\n';
- cout << "So luong so khong: " << n - neg - pos << '\n';
- return 0;
- }
Add Comment
Please, Sign In to add comment