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 string function c?
What is the best organizational structure?
What is a example of a variable?
What is "Hungarian Notation"?
What is conio h in c?
Which programming language is best for getting job 2020?
What is the use of getch ()?
What is the difference between struct and union in C?
Does c have function or method?
What is wrong with this statement? Myname = 'robin';
Is using exit() the same as using return?
write a c program for swapping two strings using pointer
What is difference between static and global variable in c?
Is c language still used?
When was c language developed?