Answer to Question #13587 in C++ for marienel ortiz
program that will accept the 50 input numbers.after the input process, display all the numbers divisible by 5 from the input.
1
2012-08-31T09:47:34-0400
#include <iostream>
using namespace std;
void
main()
{
const int NUM_COUNT = 50;
int arr[NUM_COUNT], index =
0;
for(int i = 0; i < NUM_COUNT; ++i)
{
int
number;
cout << "Enter number #" << i + 1 << ":
";
cin >> number;
if (number % 5 == 0 &&
number != 0)
{
arr[index] = number;
index++;
}
}
cout << "Numbers divisible by 5:"
<< endl;
for(int i = 0; i < index; ++i)
{
cout
<< arr[i] << endl;
}
cout << "\n\nEnter 0 for
exit...";
cin >> index;
}
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