Last active
December 23, 2015 12:39
-
-
Save hiyorineko/6636996 to your computer and use it in GitHub Desktop.
素数を表示したいけどうまくいかない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sosuu{ | |
public static void main(String[] args){ | |
//変数宣言 | |
int A = 2; | |
//100までの素数を表示する | |
for(A=2;A<=100;A++){//とりあえずAを2からはじめて1ずつ100まで足す | |
if(A%2!=0 && A%3!=0 && A%5!=0 && A%7!=0){//自身と1以外で割れる数字をはぶきたい | |
System.out.println(A); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment