write a program to find the number of even integers and odd
integers in a given array in c language

Answer Posted / jasna.c

#include<stdio.h>
#include<conio.h>
void main()
{
int arr[100],i,odd=0,even=0,n;
printf("enter the size of the array");
scanf("%d",&n);
printf("Enter the %d array elements",n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++)
{
if(arr[i]%2==0)
{
even++;
}
else
{
odd++;
}
}
printf("\n The number of even numbers in the array :%d ",even);
printf("\n The number of odd numbers in the array : %d",odd);
getch();
}

Is This Answer Correct ?    26 Yes 41 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of the statement: strcat (S2, S1)?

648


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

595


What does emoji p mean?

616


Write programs for String Reversal & Palindrome check

603


Is there sort function in c?

587






the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

1814


Describe the header file and its usage in c programming?

632


Is null valid for pointers to functions?

621


Explain can you assign a different address to an array tag?

655


What is dynamic dispatch in c++?

569


Give basis knowledge of web designing ...

1588


what type of questions arrive in interview over c programming?

1567


When would you use a pointer to a function?

595


What are the features of the c language?

656


Explain how can I remove the trailing spaces from a string?

636