Write a program that prompts the user to enter two positive integers m and n where m < n then output all prime numbers in the range m and n, inclusive. You must write a function that would test a number whether it is prime.
//prime.cpp
//##
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
bool isPrime(int number); //function prototype
int main(){
int m;
int n;
cout<<"Enter 2 numbers to\nfind primes\nFirst: ";
cin>>m;
cout<<"Second: ";
cin>>n;
while(!(m<n)){//while m is not less than n
cout<<"Enter first number again: ";
cin>>m;
cout<<"Second: ";
cin>>n;
}//end while
for(int number=m;number<=n;number++){
if(isPrime(number))
cout<<number<<' ';
}//end for
cout<<endl;
return 0; //inidcates success
}//end main
bool isPrime(int number){
int divisible_numbers=0;
for(int i=1;i<=number;i++){
if(number%i==0)
++divisible_numbers;
}//end for
if(divisible_numbers==2)
returntrue;
returnfalse;
}//end function isPrime