Print Prime Numbers In Given Range - Java Quiz Question



Write a program to print the prime numbers in the given range. Spaces between numbers are important and all the numbers should be in the same line. Use System.out.println or System.out.print for printing.

Input (Integer, Integer) Printed Output
1, 10 2 3 5 7
10, 20 11 13 17 19

class PrintPrimeNumbers

{    public static void main(String s[])
    {
        printPrimeNumbers(30,40);

    }


public static void printPrimeNumbers(int startValue, int endValue)
{
//Write code here to print the prime numbers between the startValue and endValue. Use System.out.println or System.out.print for printing.
}
}