Get the App
SLTechnology News&Howtos  ›  Development  › 

How to judge primes by java

Shulou Source: shulou.com Published: 2022-05-31 17:49:27 09月21日 Update

This article introduces the relevant knowledge of "how to judge primes by java". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The operating environment of this tutorial: windows7 system, java10 version, DELL G3 computer.

1. The method of judging primes: divide a number from 2 to sqrt (this number). If it can be divisible, it shows that the number is not a prime number, on the contrary, it is a prime number.

Sqrt refers to the square, its function is to improve the speed of operation, or not to use.

Public class sushu {public static void main (String [] args) {int count=0; for (int iTunes 101)

Tags: Prime counter number content number more knowledge output practicality achievement and then function dilemma reality situation tutorial article method case environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Shulou Tech Info Shulou Information OPPO Reno