Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int number;
- int sum = 0;
- cin >> number;
- for(int i = 1; i < number; i++)
- {
- if(number % i == 0)
- {
- sum += i;
- }
- }
- cout << "The sum of all the divisors of number " << number << " is " << sum << "." << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement