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


Please Help Members By Posting Answers For Below Questions

What is the difference between declaring a variable by constant keyword and #define ing that variable?

2982


What is difference between scanf and gets?

829


using for loop sum 2 number of any 4 digit number in c language

1957


Where is volatile variable stored?

822


What is function and its example?

873






What are the types of data files?

905


What are nested functions in c?

749


What are the advantages of the functions?

838


What is the purpose of & in scanf?

813


What is FIFO?

1088


What does c mean?

757


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.

2521


What is declaration and definition in c?

729


What is pass by reference in c?

831


Define VARIABLE?

888