fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. long long num = 2520;
  7. long long factor[999], halfof = num / 2;
  8. long long i;
  9.  
  10. for (i = 0; i < 999; i++){
  11. factor[i] = 0;
  12. }
  13.  
  14. int factorIndex = 0;
  15. for (i = 2; i <= halfof; i++){
  16. if (num % i == 0){
  17. factor[factorIndex++] = i;
  18. }
  19. }
  20.  
  21. for (i = 0; i < factorIndex ; i++){
  22. printf("%ld ", factor[i]);
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 4284KB
stdin
Standard input is empty
stdout
2 3 4 5 6 7 8 9 10 12 14 15 18 20 21 24 28 30 35 36 40 42 45 56 60 63 70 72 84 90 105 120 126 140 168 180 210 252 280 315 360 420 504 630 840 1260