write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / ankit kr. sharma
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,neg=0,even=0,odd=0;
printf("Enter the elements for the array:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("The array is:");
for(i=0;i<10;i++)
{
printf("%d\t", a[i]);
}
for(i=0;i<10;i++)
{
if (a[i]<0)
neg++;
else if(a[i]%2==0)
even++;
else
odd++;
}
printf("\nthe odd no.s in the array are: %d\t",odd);
printf("\nthe negative no.s in the array are: %d\t",neg);
printf("\nthe even no.s in the array are: %d\t",even);
}
| Is This Answer Correct ? | 10 Yes | 11 No |
Post New Answer View All Answers
How can I recover the file name given an open stream or file descriptor?
What is putchar() function?
What is the meaning of && in c?
When should a far pointer be used?
What is ambagious result in C? explain with an example.
What is structure packing in c?
What is a structure in c language. how to initialise a structure in c?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
What is memcpy() function?
What are the data types present in c?
Why main function is special give two reasons?
Is c object oriented?
In a switch statement, what will happen if a break statement is omitted?
What is substring in c?
List the different types of c tokens?