Вот мой код ниже:
Код: Выделить всё
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// program to check prime numbers b/w two numbers
Scanner sc = new Scanner(System.in);
byte factorsCount = 0;
System.out.println("Enter first number: ");
int numOne = sc.nextInt();
System.out.println("Enter second number: ");
int numTwo = sc.nextInt();
System.out.println("The prime numbers are: ");
for (int i = numOne+1; i < numTwo; i++) {
for (int j = 1; j
Подробнее здесь: [url]https://stackoverflow.com/questions/78009411/why-is-my-program-to-find-prime-numbers-within-a-range-not-working-the-way-its[/url]