using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hello_world
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("请输入需要判断的整数:");
int intNum = Convert.ToInt32(Console.ReadLine());
if (intNum % 2 == 0)
{
Console.WriteLine(intNum + "是偶数");
}
else
{
Console.WriteLine(intNum + "不是偶数,是奇数");
}
Console.ReadKey();//定位控制台
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hello_world
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("请输入需要判断的整数:");
int intNum = Convert.ToInt32(Console.ReadLine());
string strResult=intNum%2==0? "是偶数":"是奇数"; //条件运算符不能单独作为语句出现
Console.WriteLine(intNum + strResult);
Console.ReadKey(); //定位控制台
}
}
}