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 output redirection?
How can you determine the maximum value that a numeric variable can hold?
How arrays can be passed to a user defined function
Explain the difference between the local variable and global variable in c?
Write a program in c to replace any vowel in a string with z?
can anyone suggest some site name..where i can get some good data structure puzzles???
what is ur strangth & weekness
In a byte, what is the maximum decimal number that you can accommodate?
Explain heap and queue.
What does #pragma once mean?
Tell us something about keyword 'auto'.
What is the use of extern in c?
Why main function is special give two reasons?
What are called c variables?
How can you restore a redirected standard stream?