Create a 10 element array of integers and count the number of odd and even values in it.

#include <stdio.h>

int main(void)
{
int arr[10], i, odd, even;

printf("\nEnter ten integer values : ");
for(i = 0 ; i < 10; i++)
scanf("%d", &arr[i]);

for(odd = even = i = 0; i < 10; i++)
{
if(arr[i] % 2 == 0) even++;
else odd++;
}

printf("\nTotal even values is %d\nTotal odd values is %d", even, odd);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin