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

    Jul 23, 2024 · Write a program to print the first 10 prime numbers. Output Format: 2, 3, 5, 7, 9... Approach: Prime Test: To check whether a number N is prime we can check its divisibility with each number from 2 to N - 1, If it is divisible by any number in this range, we can conclude that N is not a prime number.

  2. java - Printing the first N prime numbers - Stack Overflow

    The statement is: Write a program that reads an integer N and prints the first N prime numbers. public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.

  3. Java Program to Print Prime Numbers - W3Schools

    This Java program demonstrates how to calculate and print prime numbers. Whether you aim to print prime numbers from 1 to 100 in Java or want to understand the logic behind identifying a prime number in Java, this tutorial has you covered.

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

    Jan 8, 2025 · Prime numbers are the natural numbers that can be divided by their self or by 1 without any remainder. NOTE: 2 is the only even prime number. In this program, we need to print the first 10 prime numbers: 2,3,5,7,11,13,17,19,23,29.

  5. Print First 10 Prime Numbers in Java

    Jul 19, 2022 · Print First 10 Prime Numbers in Java. Now we will print first ten prime number using java program . 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 ...

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

    Oct 8, 2024 · Algorithm to print prime numbers: 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 prime numbers using loop.

  7. Generate and print first N prime numbers - GeeksforGeeks

    Mar 30, 2023 · Generate all prime numbers between two given numbers. The task is to print prime numbers in that range. The Sieve of Eratosthenes is one of the most efficient ways to find all primes smaller than n where n is smaller than 10 million or so. Examples: Input : start = 50 end = 100 Output : 53 59 61 67

  8. Prime Number Program in Java to Check & Print Prime Numbers

    Mar 24, 2025 · Learn how a prime number program in Java can be used to print prime numbers. Explore different methods to check prime numbers from 1 to 100.

  9. Java Program to Print Prime Numbers from 1 to N - Tutorial …

    In this article, we show how to write a Java program to Print Prime Numbers from 1 to N using For Loop, While Loop, and Functions.

  10. 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

Refresh