write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / ravestar
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int a[5],count_even=0,count_odd=0,i;
for(i=0;i<5;i++)
scanf("%d",&a[i]);
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
cout<<"Even:"<<count_even<<"\n"<<"Odd:"<<count_odd;
getch();
}
| Is This Answer Correct ? | 8 Yes | 7 No |
Post New Answer View All Answers
What is difference between structure and union in c programming?
What is double pointer in c?
Explain how can you be sure that a program follows the ansi c standard?
How can a program be made to print the line number where an error occurs?
All technical questions
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What are the properties of union in c?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
I came across some code that puts a (void) cast before each call to printf. Why?
How will you write a code for accessing the length of an array without assigning it to another variable?
can we change the default calling convention in c if yes than how.........?
What is f'n in math?
What is the difference between array and linked list in c?
What is pass by reference in c?
What is null in c?