Finding divisors

Show 80 post(s) from this thread on one page
Page 2 of 2 First 12
• 10-04-2008
tabstop
Quote:

Originally Posted by xbusterx
um like sum += num ?

Right.
• 10-04-2008
xbusterx
Quote:

Originally Posted by tabstop
Right.

Ya don't I don't know how to do that here since i is changing.
• 10-04-2008
tabstop
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.)
• 10-04-2008
xbusterx
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 &#37; i = 0 )     sum += i```
• 10-04-2008
tabstop
You have to use == to compare numbers, but yes, that's what we've been waiting for.
• 10-04-2008
xbusterx
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?
Show 80 post(s) from this thread on one page
Page 2 of 2 First 12