Write a function that receives two numbers as an argument and display all prime numbers between these two numbers. Call this function from main( ).

Source Code

#include<iostream>
using namespace std;

void showprime(int, int);

int main()
{

	int x,y;
	cout<<"Enter first  number : ";
	cin>>x;

	cout<<"Enter second  number : ";
	cin>>y;
	showprime(x,y);

	
	return 0;
}

void showprime(int a, int b)
{
	bool flag;

	for(int i=a+1;i<=b;i++)
	{

		flag=false;
		for(int j=2;j<i;j++)
		{

			if(i%j==0)
			{
				flag=true;
				break;
			}
		}

		if(flag==false && i>1)
			cout<<i<<endl;
	}
}


Output

Enter first number : 15
Enter second number : 70
17
19
23
29
31
37
41
43
47
53
59
61
67