Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int EvenCount(int *arr, int n)
- {
- int i, cnt = 0;
- for(i = 0; i < n; i++)
- {
- if((*arr) % 2 == 0)
- cnt++;
- arr++;
- }
- return cnt;
- }
- int main()
- {
- int i, j, k, sz, n;
- cout<<"Enter the size of the array : ";
- cin>>n;
- int arr[n];
- cout<<"Enter the elements : ";
- for(i = 0; i < n; i++)
- cin>>arr[i];
- cout<<"The number of even numbers in the array : "<<EvenCount(arr, n)<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement