64 638
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #20274 in C++ for sidra ahsaan

Question #20274
find even and odd numbers from n integers
Expert's answer
#include <stdio.h>
#include <iostream.h>

bool odd(int a){
if (a%2!=0) return true;
else return false;
}

void main()
{
int b[9999], n, i;
cout<<"how many integers do you want to set? ";
cin>>n;
cout<<"enter "<<n<<" integers: ";
for (i=0;i<n;i++) cin>>b[i];
cout<<"\neven:\n";
for (i=0;i<n;i++) if(!odd(b[i])) cout<<b[i]<<" ";
cout<<"\n";
cout<<"\nodd:\n";
for (i=0;i<n;i++) if(odd(b[i])) cout<<b[i]<<" ";
cout<<"\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions