using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
double x, y;
Console.WriteLine("请输入一个数字来给X赋值:");
x = double.Parse(Console.ReadLine());
x = Convert.ToDouble(x);
if (x > 6)
y = 5 / 27 * (x * x + 4 * x - 6);
else if (x > 0 && x <= 6)
y = Math.Log(16, 3) + x;
else y = 23.0 / 7 * Math.Abs(x * x * x + 4);
Console.WriteLine("y={0}", y);
}
catch
{
Console.WriteLine("你应该输入一个数字!");
}
Console.ReadLine();
}
}
}
07-09
454
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)