[Procedure 2]
Question: determine the number of prime numbers between-and output all prime numbers.
1. Program Analysis: Method for Determining prime numbers: Remove 2 to SQRT (This number) with a single number. If the number can be divisible,
It indicates that this number is not a prime number, and vice versa.
Import Java. util. *; <br/> public class primetest <br/> {<br/> Public static void main (string [] ARGs) <br/>{< br/> int x = 0; <br/> vector v = new vector (); // set, used to hold all prime numbers <br/> for (INT I = 101; I <= 200; I ++) <br/>{< br/> Boolean B = true; // The Label B is true <br/> for (Int J = 2; j <I; j ++) <br/>{< br/> if (I % J = 0) // determine whether the remainder is 0 <br/>{< br/> B = false; // if the value is 0, set the label to false <br/> break; // This loop can be exceeded. <br/>}< br/> If (B = true) // <br/> {<br/> v. add (I); // Add the conforming I to the set <br/> X ++; // Add 1 to the number of prime numbers <br/>}< br/> system. out. println ("+ x +" prime number "in the middle of" 100 to 200 "); <br/> system. out. println ("prime number:/N" + V); <br/>}< br/>}