Advertisement
Guest User

Untitled

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