如何輸入一個3的倍數的數字,它顯示if語句的數字不是3的倍數,它會轉到else語句。如果你能幫助我,我將非常感激。Multi of 3 If else語句
Console.Write("Enter Number: ");
int N = Convert.ToInt32(Console.ReadLine());
if (N == 3) //<<< what do I do here
{
Console.WriteLine("Is multi of 3");
}
else
{
Console.WriteLine("Is not multi of 3");
}
Console.ReadLine();
N%3 == 0 http://www.cprogramming.com/tutorial/modulus.html – kenny