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 difference between class and object in c?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What are the different data types in C?
How are strings stored in c?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Is multithreading possible in c?
How to implement a packet in C
What are inbuilt functions in c?
What is the size of array float a(10)?
How can I open a file so that other programs can update it at the same time?
What is time complexity c?
What is a node in c?
What is structure of c program?
about c language
How important is structure in life?