write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / ankit kumar sharma
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],count_even=0,count_odd=0,i;
printf("Enter the value in Array\n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* Calculating number of odd and even intergers */
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
/* display the number of odd and even intergers */
printf(" Total number of even integer are %d\n ",count_even);
printf("Total number of odd integer are %d", count_odd);
getch();
}
| Is This Answer Correct ? | 13 Yes | 16 No |
Post New Answer View All Answers
What is the use of ?: Operator?
How many parameters should a function have?
What is header file definition?
Can you please explain the difference between malloc() and calloc() function?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
What is main return c?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
Explain the difference between null pointer and void pointer.
What is new line escape sequence?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
Why does everyone say not to use gets?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
What is the scope of global variable in c?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
What is the difference between formatted&unformatted i/o functions?