Next prime function

private static int nextPrime(int num) {
        num++;
        for (int i = 2; i <num; i++) {
            if(num%i == 0) {
                num++;
                i=2;
            } else{
                continue;
            }
        }
        return num;
    }

Comments

Popular posts from this blog

Factorial of consecutively 5 numbers(input)

Square Root of a number without using math.h function

prime number print as per given range