How do i write this code in C program? i am stuck on it for the past 3 hrs.Suggestions are welcomed

Posted by Different-Affect-690@reddit | learnprogramming | View on Reddit | 12 comments

Print all prime numbers between a and b using functions 

prime number is a whole number that has exactly two factors which are itself and 1, whereas a composite number has factors in addition to 1 and itself.

Given 2 numbers a and b, you need to write a function which will print all prime numbers between these two given numbers (inclusive).

If there are no prime numbers between the given range, print -1.

Input Format

First line contains two integers a 
and
 b.

Output Format

Print the prime numbers separated 
by
 space.

Sample Input:

2 10

Sample Output:

2 3 5 7