fork download
  1. // your code goes here
  2. const soal1 = (initx) => {
  3. let finalValue = 0;
  4. let arrx = [];
  5. for (let i = 0; i <= initx; i++) {
  6. if (i % 3 === 0 && i % 5 === 0) {
  7. arrx.push(i);
  8. } else if (i % 3 === 0) {
  9. arrx.push(i);
  10. } else if (i % 5 === 0) {
  11. arrx.push(i);
  12. }
  13. }
  14. for (let i = 0; i < arrx.length; i++) {
  15. finalValue += arrx[i];
  16. }
  17. return finalValue;
  18. };
  19. soal1(25);
Success #stdin #stdout 0.03s 16460KB
stdin
Standard input is empty
stdout
Standard output is empty