Menu
Question Index
...


Write a program to create the map of twin primes in the given input range. The input range is provided as a string. For e.g., 1-25 is for the range 1 to 25.

Input (String) Output (Map)
1-25 {1=3, 3=5, 5=7, 11=13, 17=19}
26-80 {29=31, 41=43, 59=61, 71=73}
50-300 {59=61, 71=73, 101=103, 107=109, 137=139, 149=151, 179=181, 191=193, 197=199, 227=229, 239=241, 269=271, 281=283}
19-30 {}(EMPTY)
5-15 {5=7, 11=13}

class CreateTwinPrimesMap

{    public static void main(String s[])
    {
        System.out.println("The map of twin primes is : " + createTwinPrimesMap("5-15"));

    }


public static Map<Integer, Integer> createTwinPrimesMap(String input) {
//Write code here to create the map of twin primes in the given range
}
}

Doubts

Problems

Topic: TreeMap In Java - java.util.TreeMap

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App