Sunday, July 12, 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

ERROR: Permission to repository.git denied to username. fatal: The remote end hung up unexpectedly

August 31, 2019 beroza

How to convert boolean result into integer in JavaScript?

August 26, 2021 beroza

Most useful software design patterns

December 26, 2018 beroza

error: variable might not have been initialized Java

November 14, 2019 beroza

Enforce noninstantiability with a private constructor

January 22, 2020 beroza

Longest Subsequence With Limited Sum

January 8, 2023 beroza

Write a Program to Reformat The String

January 10, 2023 beroza
infoguard

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

July 11, 2021 Sourav Paul

Write a program to find permutations

December 25, 2022 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.