</pre><pre name="code" class="csharp">//soopright (c) 2014软件技术1班
//作者:A36黄阿德
//完成日期:2014年11月7日
//问题描述:编写一个程序,用x来表示y的值
//输入描述:两个任意数x,y
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
double y, x;
Console.WriteLine("请输入一个数值");
x = Convert.ToDouble(Console.ReadLine());
if (x < 2) y = x;
else if (x < 6) y = Math.Pow(x, 2) + 1;
else if (x < 10) y = Math.Sqrt(x + 1);
else y = 1 / (x + 1);
Console.WriteLine("y的值:{0} x的值:{1}", y, x);
Console.Read();
}
}
}
用X来求Y的值
最新推荐文章于 2024-04-04 18:34:07 发布