Write code by c ++. fill in the blank

Write a function to print out all prime numbers in a given range (exclude the upper bound). Each testcase is described as follow:
Input: N M
0 <= N <= 1000
0 <= M <= 1000
Input: 1 10
Output: 2 3 5 7

Input: 3 5
Output: 3

Input: 24 28

Note: Print “\n” at the end and don’t print unnecessary characters.



using namespace std;

void print_primenum(int l, int r){

\ To Do


int main(int arg, char** argv){
ifstream ifs;
int l, r;
ifs >> l >> r;
print_primenum(l , r);
catch (char const* s)
printf(“An exception occurred. Exception type: %s\n”, s);

return 0;


Wait, this question is so unclear. Have a look at A Hitchhiker's Guide to Asking Questions!
Also , it would help as mentioned in the above post if you explained your approach so far and formatted the code.

I don’t know, the whole question. My only task is to fill in the blank paragraphs.