FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Some problems in Looping.
NewsWeb Development

Some problems in Looping.

via Dev.to JavaScriptMadhavan G4h ago

1.Multiples of 3 and 5 Code: let i=1; while(i<50){ if(i%3==0 && i%5==0){ console.log(i); } i++; } What the code is doing: - It Start from i = 1 - It Will Loop until i < 50 - Check if i is divisible by both 3 and 5 - If yes → Then it will be printed - Increase i every time Screenshot of the Program: 2.Prime Number code: let count=0; let num=5; let i=1; while(i<=num){ if(num%i==0){ count++; } i++ } if(count==2){ console.log("It is a PrimeNumber") }else{ console.log("It not a PrimeNumber") } What the code is doing: - Start with i = 1 - Loop until i <= num - Check if num is divisible by i - If yes → increase count - Increase i every time - After loop ends: - If count == 2 → print Prime Number - Else → print Not a Prime Number Screenshot of the Program: 3.count of digits Code: let num=12345; let count=0; while(num>0){ num= Math.floor(num/10); count++; } console.log(count) What the code is doing: - Start with num = 12345 - Start with count = 0 - Loop until num > 0 - Inside the loop: - Remove

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
2 views

Related Articles

Rivian gets another $1B from Volkswagen
News

Rivian gets another $1B from Volkswagen

TechCrunch • 4h ago

News

Uses for nested promises

Lobsters • 4h ago

Yes, you need a smart bird feeder in your life - and this one's on sale
News

Yes, you need a smart bird feeder in your life - and this one's on sale

ZDNet • 5h ago

Apple pulls the plug on its high-priced, oft-neglected Mac Pro desktop
News

Apple pulls the plug on its high-priced, oft-neglected Mac Pro desktop

Ars Technica • 5h ago

Applying accessibility fixes with stealth for the greater good
News

Applying accessibility fixes with stealth for the greater good

Lobsters • 5h ago

Discover More Articles