Write a program that prints the count of all prime numbersbetween A and B (inclusive), where A and B are defined asfollows:
A = The 5 digit unique number you had picked at the beginning ofthe semester
B = A + 5000
Just a recap on prime numbers: A prime number is any number,greater or equal to 2, that is divisible ONLY by 1 and itself. Hereare the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and29.
Rules:
You should first create a boolean function called isPrime anduse that function in your program. This function should take in anyint and return true if the number is prime, otherwise, return afalse. In the main body of your program, you should create a loopfrom A to B (inclusive) and use isPrime function to determine ifthe loop number should be counted or not.
Your program SHOULD NOT PRINT the individual prime numbers. Youcan print them for your own testing purpose, but in the finalsubmission, comment out such print statements.
Your program SHOULD ONLY PRINT the answer -- which is anumber.
Do not print extra characters in your answer (E.g. \"answer=123\"instead of 123)
the values for me:
A = 5000;
B = A+5000;
sample code to get started--->>>>>>>>>>
#includeusing namespace std;bool isDivisibleBy(int num, int divisor) { // function returns true if num is divisible by divisor if(num % divisor == 0) { return true; } else { return false; }}bool isodd(int num) { // function returns true if num is odd if( isDivisibleBy(num,2) ) { return false; } else { return true; }}int main() { const int A = 1; const int B = 100; const int N = 17; int count = 0; // count of the numbers between A and B that are odd and divisible by N for(int i=A; i<=B; i++) { if( isDivisibleBy(i,N) && isodd(i) ) { count++; } } // just print the answer and nothing else... cout << count << endl; return 0;}