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

    Nov 10, 2020 · In this article, You'll learn how to use a while loop to print prime numbers in java. This is a very basic programming interview question for the freshers. First, we'll talk about …

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

    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++; The statement i++ is unreachable, so you …

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

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

    Inside the for loop, we check if the number is divisible by any number in the given range (2...num/2). If num is divisible, flag is set to true and we break out of the loop. This determines …

  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. Java Program to Print Prime Numbers - CodesCracker

    Print Prime Numbers in Java using while Loop. The previous program can also be written using while loop, instead of for. For this, just replaced the for loop's block of code, with following …

  7. Java while loop find prime numbers

    An integer greater than 1 is prime if its only positive divisor is 1 or itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. To test whether a number is prime, check …

  8. 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: You can insert this function call in a loop where you can pass a new number every iteration. I am using …

  9. Java Program to check whether a given number is Prime or not using

    While loop in C; Steps to writing prime number program in java. Here we are using “Scanner” to take input for numbers. We will start the loop from 2 as 1 is not a prime number and limit it to …

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

  11. Some results have been removed
Refresh