本帖最后由 ccyznhy 于 2013-8-25 22:44 编辑
public static void main (String[] args)
{
c = new Console ();
int integer = 0;
boolean isPrime;
char conti;
do
{
c.println ("Please enter in an integer.");
c.println ("This program will test if this integer is a prime number.");
integer = c.readInt ();
isPrime (integer);
c.println ();
c.println ("Do you wish to continue? Y/N?");
conti = c.readChar ();
}
while (conti == 'y' | conti == 'Y');
} // main method
public static boolean isPrime (int number)
{
int count = 2;
for (count = 2 ; count <= number ; count++)
{
if (number % count == 0)
return false;
else
return true;
}
}
}//为什么它说我最后的布尔值不匹配..?求解决啊各位大神!
|