+ 1

Write a function programme to count odd elements present in an array

function

29th Mar 2018, 8:58 AM
Manisha Seth
Manisha Seth - avatar
3 ответов
+ 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.
29th Mar 2018, 12:42 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
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++; } }
29th Mar 2018, 12:42 PM
TurtleShell
TurtleShell - avatar
0
yes I have tried
29th Mar 2018, 2:21 PM
Manisha Seth
Manisha Seth - avatar