Answer to Question #3322 in C++ for mukunda
Take N numbers in an array; print all even numbers and odd numbers separately.
1
2011-07-11T10:03:18-0400
#include <iostream>
using namespace std;
int main()
{
const int N = 5;
int arr[N] = { 10, 46, 37, 8, 19 };
cout << "Even numbers: ";
for (int i = 0; i < N; ++i)
& if (arr[i] % 2 == 0)
& cout << arr[i] << " ";
cout << endl;
cout << "Odd numbers: ";
for (int i = 0; i < N; ++i)
& if (arr[i] % 2 == 1)
& cout << arr[i] << " ";
cout << endl;
return 0;
}
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment