Printable View

Quote: Originally Posted by xbusterx um like sum += num ? Right.

Quote: Originally Posted by tabstop Right. Ya don't I don't know how to do that here since i is changing.

Quote: Originally Posted by xbusterx Ya don't I don't know how to do that here since i is changing. Since that's exactly what you want and need to happen, I fail to see how that's a problem. (Or is your task not to add, but to count? In that case you would always add 1, since that's how people count.)

Quote: Originally Posted by tabstop Since that's exactly what you want and need to happen, I fail to see how that's a problem. (Or is your task not to add, but to count? In that case you would always add 1, since that's how people count.) Ok so can I do this? Code: int sum =0; int n; cout << enter number; cin >> n; for (int i = 1 ; i < n ; i++ ) if ( n % i = 0 ) sum += i

int sum =0; int n; cout << enter number; cin >> n; for (int i = 1 ; i < n ; i++ ) if ( n % i = 0 ) sum += i

You have to use == to compare numbers, but yes, that's what we've been waiting for.

Quote: Originally Posted by tabstop You have to use == to compare numbers, but yes, that's what we've been waiting for. Code: int sum =0; int n; cout << enter number; cin >> n; for (int i = 1 ; i < n ; i++ ) if ( n % i == 0 ) sum += i better lol?

int sum =0; int n; cout << enter number; cin >> n; for (int i = 1 ; i < n ; i++ ) if ( n % i == 0 ) sum += i