Lucian_Adrian

#388 Numarul Divizorilor Pari

Nov 2nd, 2021
78
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,nr,d;
  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==0) nr++;
  12. if((n/d)%2==0) nr++;
  13. }
  14. }
  15. if((d*d==n)&&(d%2==0)) nr++;
  16. cout<<nr;
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment