Question #37704

take an 1-D array of 10 numbers and print even numbers at even places in the array...HELP!
1

Expert's answer

2013-12-11T03:44:52-0500

Answer on Question #37704– Programming - C++


#include <iostream>
using namespace std;
int main()
{
    int lArr[10];
    for(int i = 0; i < 10; ++i)
    {
        lArr[i] = i + 1;
    }
    for(int i = 0; i < 10; ++i)
    {
        if((lArr[i] % 2 == 0) && ((i+1) % 2 == 0))
            cout << lArr[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!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS