About 1,470,000 results
Open links in new tab
  1. 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 …

  2. Program to print prime numbers from 1 to N. - GeeksforGeeks

    Jul 12, 2025 · First, take the number N as input. Then use a for loop to iterate the numbers from 1 to N Then check for each number to be a prime number. If it is a prime number, print it. Approach 1: Print …

  3. Prime Number Program in Java - GeeksforGeeks

    Mar 17, 2026 · 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 …

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

    Jul 23, 2025 · For a given number N, the purpose is to find all the prime numbers from 1 to N. Examples: Input: N = 11 Output: 2, 3, 5, 7, 11 Input: N = 7 Output: 2, 3, 5, 7 Approach 1: Firstly, consider the …

  5. Prime Numbers in Maths - GeeksforGeeks

    Jan 28, 2026 · Nth Prime Number Program to print prime numbers from 1 to N. Segmented Sieve Also Check: Prime Numbers Worksheet Solved Examples of Prime Numbers Example 1: Determine …

  6. Generate and print first N prime numbers - GeeksforGeeks

    Jul 23, 2025 · Approach 2: Below code also generates the first N prime numbers, but it is more efficient than the previous code because it only checks odd numbers after 2, and only checks them for …

  7. Prime Number Program in Java - Tpoint Tech

    Jan 31, 2026 · A prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers cannot be divided by other than itself or 1.

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

    Sep 10, 2022 · 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 …

  9. Program to print the first 10 prime numbers - Tpoint Tech - Java

    Mar 17, 2025 · Prime Numbers Prime numbers are the natural numbers that can be divided by their self or by 1 without any remainder. For example: 2, 3, 5, 7, 11, 13, 17 etc.

  10. Prime numbers in a given range in Java | PrepInsta

    In this article we wil see a program to find Prime numbers in a given range in Java. User are supposed to enter two range.