Sunday, October 4, 2026
Latest:
  • Präsentation für b1
  • Verb “werden” Konjugation
  • In German, verb sein (to be) Konjunktion
  • Wichtige wörter für B1 prüfung
  • What are the main differences between ApplicationContext and BeanFactory?
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

Write an efficient program to print prime numbers.

Published: November 19, 2021 code, JavaScript, number, prime, prime number

What is a prime number?

Prime numbers are numbers that are greater than 1 and it has only two factors, 1 and the number itself.

The solution to print prime number:

Following is the code to write prime number up to 20 in JavaScript.

    for(let i = 2; i < 20; i++){
        for(let j = 2; j <= i; j++) {
            if(i % j === 0 && j !== i){
                break;
            }

            if (i === j) {
                console.log(i);
            }
        }
    }

You May Also Like

How to append and prepend using JavaScript?

May 31, 2021 beroza

What is a nested class? Builder pattern with nested class

October 3, 2024 beroza

How to override WooCommerce default template file?

January 6, 2020 beroza

Write a Program to Find Two Furthest Houses With Different Colors

January 20, 2023 beroza

Difference between session.timeout.ms and max.poll.interval.ms for Kafka

June 9, 2020 beroza

JavaScript tips for problem solving

June 11, 2023 beroza
infoguard

What is VPN? How does VPN work? What are the benefits of VPN?

July 11, 2021 Sourav Paul

The module bcrypt_lib was compiled against a different Nodejs version

May 23, 2020 beroza

How to set environment variables on Mac OS and Ubuntu?

July 3, 2020 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2026 Upokary. All rights reserved.