Given a range, you need to count the number of prime numbers in the range.
Note that "1" is not the prime number.
For example:
The range is 1~10
You need to print 4.
Beacuse of there are 4 numbers (2, 3, 5, 7 are the prime numbers) in the range 1~10.
Note that
1. This problem involves three files.
You will be provided with main.cpp and function.h, and asked to implement function.cpp.
2. For OJ submission:
Step 1. Submit only your function.cpp into the submission block. (Please choose c++ 11 compiler)
Step 2. Check the results and debug your program if necessary.
function.h
#ifndef FUNCTION_H
#define FUNCTION_H
int numPrime(int start, int end);
#endif
main.cpp
#include <stdio.h>
#include "function.h"
int main(){
int start, end, num;
scanf("%d %d", &start, &end);
num = numPrime(start, end);
printf("%d", num);
return 0;
}
Given the start and end of the range: S E.
Fisrt number S is the start number of the range.
Second number E is the end number of the range.
And the range limit is 1 <= S <= E <= 5000.
For example:
when input is "1 10", it means the range is 1 to 10.
Count the number of prime numbers in the range.
Note that you do not need to print '\n' at the end of the output.