So the code I have right now shows the counter going from 1-30 and at 30 it says that it has a multiple of 2, 3, and 5. But now I have to modify the problem so that the infinite loop meets these previous conditions, but in addition:
---The break can not happen if the counter is a multiple of 30
---Regardless of the logic involving multiples, the break can happen if the value of the counter is at least 3000.
If somebody can explain what it's asking and help me out I would appreciate it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
using namespace std;
int main()
{
int counter = 0;
do
{
counter += 1;
cout << "current counter value " << counter << "\n";
}
while (counter % 2 || counter % 3 || counter % 5);
cout << "is a multiple of 2, 3, and 5\n";
cin.get();
return 0;
}
|
Also I have to make the .exe display show it like this:
....
...
...
current counter value:2998
current counter value 2999
current counter value 3000
current counter value 3001 is (a multiple of 2, 3, and 5, but not a multiple of 30) or (counter > 3000).