Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned long long n,S=0;
- int d;
- cin>>n;
- if(n==1){ ///caz particular n=1
- cout<<1;
- }
- else
- {
- S= 1 + n;
- for(d=2;d*d<n;d++){
- if(n%d==0){
- S=S+d+n/d;
- }
- }
- if(d*d==n){
- S=S+d;
- }
- cout<<S<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement