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 are identifiers in c?
Does c have circular shift operators?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What is output redirection?
What are the different types of endless loops?
How important is structure in life?
Is there any possibility to create customized header file with c programming language?
provide an example of the Group by clause, when would you use this clause
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Explain modulus operator.
How are pointers declared in c?
Why is this loop always executing once?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
When should structures be passed by values or by references?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.