Company: Barclays
Difficulty: medium
Prime Numbers within Range A prime number is divisible only by 1 and itself. The teacher writes a positive integer on the board. Write an algorithm to find all the prime numbers from 2 to the given positive number. Input Format The first line of the input consists of an integer num , representing the number written on the board. Output Format Print space-separated integers representing the prime numbers requested by the teacher in increasing order. If no prime number exists within the given range, then do not print anything. Constraints 1 < num < 10 9 Example Input: 11 Output: 2 3 5 7 11 For the given number 11 , the prime numbers within the range are 2, 3, 5, 7, and 11 . Lucky Customers Gift Basket The manager of a supermarket wishes to hold an event at which he will distribute gift baskets to lucky customers. Each gift basket contains a pair of products. Each basket contains different product pairs, but the overall value of the baskets may be the same. There are N types of prod