Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int positive(int* arr, int n) {
- int count = 0;
- int* p = arr;
- for (int i = 0; i < n; i++) {
- if (*p > 0) {
- count++;
- }
- p++;
- }
- return count;
- }
- int main() {
- int n;
- cin >> n;
- int arr[n];
- for (int i = 0; i < n; i++) {
- cin >> arr[i];
- }
- cout << positive(arr, n) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement