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
What is the purpose of the statement: strcat (S2, S1)?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What does emoji p mean?
Write programs for String Reversal & Palindrome check
Is there sort function in c?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
Describe the header file and its usage in c programming?
Is null valid for pointers to functions?
Explain can you assign a different address to an array tag?
What is dynamic dispatch in c++?
Give basis knowledge of web designing ...
what type of questions arrive in interview over c programming?
When would you use a pointer to a function?
What are the features of the c language?
Explain how can I remove the trailing spaces from a string?