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 declaring a variable by constant keyword and #define ing that variable?
What is difference between scanf and gets?
using for loop sum 2 number of any 4 digit number in c language
Where is volatile variable stored?
What is function and its example?
What are the types of data files?
What are nested functions in c?
What are the advantages of the functions?
What is the purpose of & in scanf?
What is FIFO?
What does c mean?
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.
What is declaration and definition in c?
What is pass by reference in c?
Define VARIABLE?