@oldrinb和@iccthedral謝謝,但我應該使用printf或println。我編輯的這種方式,但相同識別11的倍數和奇數或偶數的輸入
之前import java.util.Scanner;
public class test
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int x;
int EO;
int Mult;
System.out.print ("Enter value: ");
x = input.nextInt();
EO=x%2;
Mult=x%11;
if(EO>0&&Mult>0)
{
System.out.printf ("%d:NOT:ODD\n",x);
}
}
}
上面看起來像java,那麼這是哪個呢? Java是**不像**一樣。 – Daedalus
只需檢查數字是否爲22的倍數。如果它可以被「2」和「11」整除,它必須被「2 * 11」整除。 – Blender
不要將Java問題標記爲「javascript」。這浪費了讀者的時間。 http://kb.mozillazine.org/JavaScript_is_not_Java,http://www.456bereastreet.com/archive/200909/java_is_not_javascript/ –