Study Notes (03): Java classical algorithm to explain - find prime numbers less than 100

Learning immediately: https://edu.csdn.net/course/play/759/10234?utm_source=blogtoedu

1. does not wrap, but the results with a tab between each interval. System.out.print (i + "\ t");

2. Any process repeated as many times, it is packaged into a function, improve the reusability of code.

3. want to judge each number again, using the loop. The result of the determination to return logical values, and then returns true or false logical value judgment to make further action. At this time may be omitted if (isPrime (i) == true) == true in

4. want to achieve once every ten-line feed, can be controlled by a variable, the output of each of a prime number, on its one, then determines if the variable is divided by 10 is 0, if 0 Enter

Released three original articles · won praise 0 · Views 16

Guess you like

Origin blog.csdn.net/weixin_44959295/article/details/105163875