You are here: Home Blog Comments Re:キミならどう書く 2.0 - ROUND 1 -

Personal tools

Re:キミならどう書く 2.0 - ROUND 1 -

Posted by Anonymous User at 2006-06-23 10:17

javaで作成してみました。
public static void main(String[] args) {
int[] s = new int[100];
int x = 0;
boolean bool = false;
for(int i = 1; i <= 100; i ++) {
bool = false;
for (int k = 0; k < x; k++) {
if (i % s[k] == 0 && s[k] != 1) {
bool = true;
break;
}
}
if (!bool) {
s[x++] = i;
System.out.println(i);
}
}
}

Parent entry キミならどう書く 2.0 - ROUND 1 -