分析:由题意可知指的是11~16岁的才可以进入。
编写代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1
{
class Program
{
static void Main(string[] args)
{
//只有年龄不大于16的青少年才可以进入
Console.WriteLine("请输入年龄:");
int n = Convert.ToInt32(Console.ReadLine());
bool TF = n >= 11 && n <= 16;
Console.WriteLine(TF);
}
}
}
程序运行结果如下:
分析:判断奇偶用÷2取余法。
编写代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1
{
class Program
{
static void Main(string[] args)
{
//输入一个数,判断奇偶
Console.WriteLine("请输入数字:");
int n = Convert.ToInt32(Console.ReadLine());
bool TF = n%2==0;
Console.WriteLine(TF);
}
}
}
程序运行结果如下:(false代表奇数,true代表偶数)
编写代码如下:
using System;
using System.Collections.Generic;
using Sys