Count the number of the twin primes in the given range - Java Quiz Question



Write a program to count the number of the twin primes in the given input range. Twin primes are those whose difference is two and the both the numbers are primes. For Eg. 1-3, 3-5, 5-7, 11-13, 17-19 are twin primes where as 5-11 or 19-21 or 19-23 are not.

Input (int, int) Output (int)
1, 25 5
26, 80 4
50, 300 13
19, 30 0
5, 15 2

class CountTwinPrimes

{    public static void main(String s[])
    {
        System.out.println("The number of the twin primes in the given range are : " + countTwinPrimes(5, 15));

    }


public static int countTwinPrimes(int rangeStart, int rangeEnd) {
//Write code here to count the number of the twin primes in the given range
}
}