Lucian_Adrian

Untitled

Oct 19th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int n , i;
  7. long long S = 0;
  8. cin >> n;
  9. for(i=1 ; i*i<n ; i++)
  10. if(n % i == 0)
  11. S += i + n / i;
  12. if(i * i == n)
  13. S += i;
  14. cout << S;
  15. return 0;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment