hi people I don't know if this is the right place, but I have a homeork assignment to list all the multiples of a number up to 10000 and seperate them with a comma except the last number should NOT have a comma after it. I have come pretty close to doing this but the last 2 numbers are messing up I don't know what I am doing wrong.
here is the code
#include <iostream>
using namespace std;
int main () {
int number;
cout << "enter a number" << endl;
cin >> number;
int count = 1;
while ( number < 10000 )
{
cout << number ;
cout << ",";
cout << " ";
number = number + number / count;
count++;
if (( number / count ) > 10000 - number)
cout << number;
}
return 0;
}
here is the code
#include <iostream>
using namespace std;
int main () {
int number;
cout << "enter a number" << endl;
cin >> number;
int count = 1;
while ( number < 10000 )
{
cout << number ;
cout << ",";
cout << " ";
number = number + number / count;
count++;
if (( number / count ) > 10000 - number)
cout << number;
}
return 0;
}