fork download
  1. #include <stdio.h>
  2. int multiples(void);
  3.  
  4. int main(void)
  5. {
  6. int mults = 0;
  7. mults = multiples();
  8. printf("%d", mults);
  9. return 0;
  10. }
  11.  
  12. int multiples(void)
  13. {
  14. int cnt, mult = 0, answer = 0;
  15. for(cnt=0;cnt<1000;cnt++)
  16. {
  17. if( cnt%3 == 0 || cnt%5 == 0)
  18. {
  19. mult += cnt;
  20. }
  21. else if( cnt % 3 == 0 && cnt % 5 == 0)
  22. {
  23. mult += cnt;
  24. }
  25. }
  26. answer = mult;
  27. return answer;
  28. }
  29.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
233168