+ 1
Write a function programme to count odd elements present in an array
function
3 Réponses
+ 4
Have you tried doing something yourself? If yes, only then we shall help, provided you post the code and tell us about the errors you face.
0
int arr[] = {1, 2, 3, 4, 5};
int oddNumbers = 0;
int len = sizeof(arr) / sizeof(arr[0]);
for (int i = 0; i < len; i++) {
if (arr[i] % 2 != 0) {
oddNumbers++;
}
}
0
yes I have tried