Skip to content

Instantly share code, notes, and snippets.

@hiyorineko
Last active December 23, 2015 12:39
Show Gist options
  • Save hiyorineko/6636996 to your computer and use it in GitHub Desktop.
Save hiyorineko/6636996 to your computer and use it in GitHub Desktop.
素数を表示したいけどうまくいかない
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