About 21,500 results
Open links in new tab
  1. Program to print first 10 prime numbers - GeeksforGeeks

    Jul 23, 2024 · A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In this article, we'll explore how to create a JavaScript program to print all prime numbers from 1 to a given number N. To find prime numbers from 1 to N, we need to: Iterate through all numbers

  2. Prime Number Program in Java - GeeksforGeeks

    Apr 7, 2025 · A prime number is a natural number greater than 1, divisible only by 1 and itself. Examples include 2, 3, 5, 7, and 11. These numbers have no other factors besides themselves and one. In this article, we will learn how to write a prime number program in Java when the input given is a Positive number. Methods to Write a Prime Number Program in Java

  3. Java Program to Print Prime Numbers - W3Schools

    Unlock efficient methods for a prime number program in Java with this tutorial. Learn to check and print prime numbers up to any limit, from 1 to 100. Ideal for boosting your skills in prime number series and generating a list of prime numbers in Java.

  4. Java Program to Display All Prime Numbers from 1 to N

    Jul 2, 2024 · The factorial of a non-negative integer is multiplication of all integers smaller than or equal to n. In this article, we will learn how to write a program for the factorial of a number in Java. Formulae for Factorialn! = n * (n-1) * (n-2) * (n-3) * ..... * 1 Example: 6! == 6*5*4*3*2*1 = 720. 5!

  5. Java program to display prime numbers from 1 to 100 and 1 to n

    Sep 10, 2022 · The number which is only divisible by itself and 1 is known as prime number. For example 2, 3, 5, 7…are prime numbers. Here we will see two programs: 1) First program will print the prime numbers between 1 and 100 2) Second program takes the value of n (entered by user) and prints the prime numbers between 1 and n.

  6. Java Program to Print Prime Numbers - CodesCracker

    Java Program to Print Prime Numbers - This article covers multiple programs in Java to print prime numbers. Print prime numbers from 1 to 100, Print first 10 prime numbers, Print prime numbers from 1 to n Print prime numbers in given range, Print prime numbers using while loop

  7. Print First 10 Prime Numbers in Java - Know Program

    Print First 10 Prime Numbers in Java | Prime numbers are natural numbers that are divisible by only 1 and the number itself. In other words, prime numbers are positive integers greater than 1 with exactly two factors, 1 and the number itself.

  8. Print First 10 Prime Numbers in Java

    Jul 19, 2022 · In this program we take variable num and count . We iterate a while loop till print first ten prime numbers . variable num increment by 1 in each iterate and count increment by 1 when find any number is prime number . Program description: Program to print the first 10 prime numbers. public static void main(String[] args) { int num =1 ,count =0;

  9. Prime Number Program in Java | Whether a Number is Prime or …

    Jan 30, 2025 · Type 1 – A Simple Program With No Provision for Input. This is one of the simplest ways of implementing a program for checking whether a number is a prime number or not in Java. It doesn’t require any input and simply tells whether the defined number (by the integer variable n) is a prime number or not. Here goes the code:

  10. Display All Prime Numbers from 1 to N in Java - Online Tutorials …

    Learn how to display all prime numbers from 1 to N using Java programming. This tutorial provides a step-by-step guide with example code.

Refresh