63 213
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #1496 in C++ for idaira

Question #1496
Write a C++ program that prompts the user to enter 10 positive integers and your program will display only all the odd numbers in a row. Use for loop(s) for the repetitive processes.
Expert's answer
#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
int numbers[10];
cout << "Input 10 integer values:" << endl;
for(int i = 0; i < 10; i++)
{
cin >> *(numbers + i);
}
cout << "Odd input values:" << endl;
for(int i = 0; i < 10; i++)
{
if(*(numbers + i) & 1)
{
cout << *(numbers + 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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions