Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

77
Views
i want to print the integer always subtacted by 3

i want to print like this 20 17 14 11 8. it should always subtract with 3

here is my code

let cv= 10
let sum=0

for(let i=20;i>5;i--){
    sum=i-3
    console.log(sum)
}

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Maybe this can help:

for(let i = 20; i > 5; i = i-3){
    console.log(i)
}

about 4 years ago · Juan Pablo Isaza Report

0

Instead of reducing i by 1 in each iteration, reduce it by 3.

for(let i = 20; i > 5; i -= 3){
    console.log(i)
}

about 4 years ago · Juan Pablo Isaza Report

0

Prints if sum >= 0.

let sum = 20
const subBy = 3

while(sum >= subBy){
  sum -= subBy
  console.log(sum)
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!