//Prime Number Calculator
import java.util.Scanner;
class PrimeNumbers {
public static void main(String[] args){
int End;
int Begin;
Scanner in = new Scanner(System.in);
//insert max value for the calculator.
System.out.println("Where should I stop?");
End = in.nextInt();
for (Begin=3; Begin<=End; Begin++){
System.out.println(Begin);
int Prime;
int PrimeList[] ;
//something is wrong around here... I don't understand what...
for (Prime:PrimeList);
PrimeList[0]=2;
if(Begin%PrimeList[Prime]!=0){
break;
}
}
}
}
素数計算機がたくさんあることは知っていますが、学校用に作りたかったのですが、どこで間違ったのかわかりません。
エラーメッセージ:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "Prime", Identifier expected after this token
Prime cannot be resolved to a type
Type mismatch: cannot convert from element type int to Prime
at PrimeNumbers.main(PrimeNumbers.java:25)