//
现代流行的"程序员"
public
static
bool
IsOdd(
int
n)
...
{
while (true)
...{
switch (n)
...{
case 1: return true;
case 0: return false;
}
n -= 2;
}
}
//
中规中矩的程序员
public
static
bool
IsOdd(
int
n)
...
{
return (n % 2 == 1) ? true : false;
}
//
有经验的C#程序员
public
static
bool
IsOdd(
int
n)
...
{
return Convert.ToBoolean(n % 2);
}
//
汇编程序员
public
static
bool
IsOdd(
int
n)
...
{
return Convert.ToBoolean(n & 1);
}
C#判断奇偶数的函数
最新推荐文章于 2020-12-05 22:34:23 发布