Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Beschreiben Sie hier die Klasse SoNguyenTo.
- *
- * Viết code in ra màn hình số nguyên tố từ 10..1000
- *
- * @author PhucVo
- * @version 2019
- */
- public class SoNguyento
- {
- public void snt()
- {
- for(int i = 10; i < 100; i++)
- {
- if(checkSNT(i))
- {
- System.out.println(i + "");
- }
- }
- }
- public boolean checkSNT(int a)
- {
- if(a < 2)
- {
- return false;
- }
- for(int i = 2; i < a; i++ )
- {
- if(a % i == 0)
- {
- return false;
- }
- }
- return true;
- }
- }
Add Comment
Please, Sign In to add comment