fork download
  1. #include <stdio.h>
  2.  
  3. int di(int x)
  4. {
  5. int even=0,odd=0;
  6. for(int i=1;i<=sqrt(x);i++)
  7. {
  8. if(x%i==0)
  9. {
  10. if(i%2)
  11. odd++;
  12. else
  13. even++;
  14. if(x/i %2==0 && x/i!=i)
  15. even++;
  16. else if(x/i!=i)
  17. odd++;
  18. }
  19. }
  20. printf("%d -> %d, %d\n", x, even, odd) ;
  21. return even-odd;
  22. }
  23.  
  24. int main(void) {
  25. di(4);
  26. di(48745);
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
4 -> 2, 1
48745 -> 0, 4