1 primes and (5 points)
Topic content:
We think 2 is the first prime number, 3 is the second Prime, 5 is the third prime, and so on.
Now, given the two integers n and m,0<n<=m<=200, your program calculates the number of primes between the nth prime number and the number of M primes, including the nth Prime and the first M prime.
Input format:
Two integers, the first representing N, and the second represents M.
Output format:
An integer representing the nth prime number and the number of primes between the first m primes, including the nth Prime and the first M prime.
Input Sample:
2 4
Sample output:
15
Progress: Conscious use of logical expressions when using an if () statement is more concise.
Core: Use if (count>=n&&count<=m) {} to calculate the number of nth primes to the number of M primes.
Trial and error process: In the 12th debugging, the discovery has always appeared i=2, as well as count=1,count=2,count=2,count=2 ...
Later found that the original variable initialization was misplaced (put i=2 in the first sentence of Loop 1, put isprime=1 in front of the loop). I=2 should be placed in front of the loop, and isprime=1 should be placed in the loop inside the first sentence, or every time the loop is i=2, and when i=4, Isprime=0, IsPrime has been equal to 0. Causes an error.
Programming exercises for the 4th week of C programming (prime number and)