Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, a[50], odd = 0, sum = 0, cnt = 0;
- cout << "Nhap n: "; cin >> n;
- for (int i = 0; i < n; i++) {
- cout << "Nhap a[" << i << "]: "; cin >> a[i];
- if (a[i] % 2 == 1) odd++;
- if (a[i] % 6 == 0) {
- sum += a[i]; cnt++;
- }
- }
- cout << "So so le: " << odd << endl;
- if (cnt == 0) cout << "Khong chua so le boi 3";
- else cout << "TBC cac so le boi 3: " << (float) sum / cnt;
- }
Advertisement
Add Comment
Please, Sign In to add comment