About 13,400 results
Open links in new tab
  1. While Loop Print Prime Numbers In Java - JavaProgramTo.com

    Nov 10, 2020 · Java Program to print prime numbers using while loop. And also example to print prime numbers from 1 to 100 (1 to N)

  2. find prime number using while loop in java - Stack Overflow

    public void isPrime(int n) { int i = 2; while (i <= (n - 1)) { if (n % i == 0) { System.out.println("It's not a prime number"); break; } else { System.out.println("It's a prime number"); break; } i++; } }

  3. 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 …

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

    Write a Java Program to Print Prime Numbers from 1 to N using For Loop, While Loop, and Functions. This program allows the user to enter any integer value. Next, this program …

  5. Prime Numbers using For Loop and While Loop in Java - eStudy

    In this tutorial, we explored how to generate prime numbers using both the for loop and while loop in Java, specifically using the BlueJ programming language. We discussed the syntax, …

  6. Basic Java - Finding if a number is a prime number using while loop ...

    Dec 24, 2021 · This is the simplest way to calculate if an integer n is probably a prime: if (n < 2) return false; BigInteger bigInt = BigInteger.valueOf(n); return bigInt.isProbablePrime(100); You …

  7. Java Program to Check Whether a Number is Prime or Not

    In this article, you'll learn to check whether a number is prime or not. This is done using a for loop and while loop in Java.

  8. java - While Loop Prime Numbers between 1 - Stack Overflow

    Apr 5, 2018 · Inside this loop you will process some stuff to determine if x is a prime number or not. This stuff your code do is to iterate through all the number from 2 to x and try for each one …

  9. Java Program to Check Prime Number - Tutorial Gateway

    Write a Java Program to Check Prime Number using For Loop, While Loop, and Functions. Prime Numbers are any natural number not divisible by any other number except 1 and itself.

  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 …

Refresh