I have a list of numbers that are printed:
1: 1,
2: 1, 2,
3: 1, 3,
How do I not include that last comma on each line?
for ( int i = 1; i <= x; ++i )
{
cout << i << ": ";
for ( int j = 1; j <= i; ++j )
{
if ( i % j == 0 )
{
cout << j << ", ";
}
}
cout << endl;
}